summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-12-04 16:15:14 +0900
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2019-08-04 18:09:15 +0000
commit447c23a97d53d8abba90da28af9537adb9bcf59c (patch)
treefe8a010ea309a5d937acc468e6c3f3ee8e670651
parent9ac30410f9f41c326992fff4859d48226a780477 (diff)
downloadbuildstream-447c23a97d53d8abba90da28af9537adb9bcf59c.tar.gz
types.py: Moving CoreWarnings to the types.py module
This also ensures it is exposed via the main buildstream __init__.py file, fixes the imports of CoreWarnings, and adjusts the documentation links to point to the right place.
-rw-r--r--buildstream/__init__.py1
-rw-r--r--buildstream/_artifactcache/artifactcache.py2
-rw-r--r--buildstream/_loader/loader.py1
-rw-r--r--buildstream/_project.py2
-rw-r--r--buildstream/element.py17
-rw-r--r--buildstream/plugin.py22
-rw-r--r--buildstream/plugins/sources/git.py3
-rw-r--r--buildstream/types.py25
-rw-r--r--doc/source/format_project.rst2
9 files changed, 35 insertions, 40 deletions
diff --git a/buildstream/__init__.py b/buildstream/__init__.py
index 895adc60f..9bfa88a26 100644
--- a/buildstream/__init__.py
+++ b/buildstream/__init__.py
@@ -28,6 +28,7 @@ if "_BST_COMPLETION" not in os.environ:
from .utils import UtilError, ProgramNotFoundError
from .sandbox import Sandbox, SandboxFlags
+ from .types import Scope, Consistency, CoreWarnings
from .plugin import Plugin
from .source import Source, SourceError, Consistency, SourceFetcher
from .element import Element, ElementError, Scope
diff --git a/buildstream/_artifactcache/artifactcache.py b/buildstream/_artifactcache/artifactcache.py
index 0beab5537..48fd32218 100644
--- a/buildstream/_artifactcache/artifactcache.py
+++ b/buildstream/_artifactcache/artifactcache.py
@@ -21,7 +21,7 @@ import os
import string
from collections import Mapping, namedtuple
-from ..element import _KeyStrength
+from ..types import _KeyStrength
from .._exceptions import ArtifactError, ImplError, LoadError, LoadErrorReason
from .._message import Message, MessageType
from .. import utils
diff --git a/buildstream/_loader/loader.py b/buildstream/_loader/loader.py
index 1605a823b..b861e86cd 100644
--- a/buildstream/_loader/loader.py
+++ b/buildstream/_loader/loader.py
@@ -34,6 +34,7 @@ from .types import Symbol, Dependency
from .loadelement import LoadElement
from . import MetaElement
from . import MetaSource
+from ..types import CoreWarnings
# Loader():
diff --git a/buildstream/_project.py b/buildstream/_project.py
index 6e4f09c68..66489986e 100644
--- a/buildstream/_project.py
+++ b/buildstream/_project.py
@@ -31,7 +31,7 @@ from ._options import OptionPool
from ._artifactcache import ArtifactCache
from ._elementfactory import ElementFactory
from ._sourcefactory import SourceFactory
-from .plugin import CoreWarnings
+from .types import CoreWarnings
from ._projectrefs import ProjectRefs, ProjectRefStorage
from ._versions import BST_FORMAT_VERSION
from ._loader import Loader
diff --git a/buildstream/element.py b/buildstream/element.py
index 370eb7547..c45bbf298 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -96,23 +96,8 @@ from . import _cachekey
from . import _signals
from . import _site
from ._platform import Platform
-from .plugin import CoreWarnings
from .sandbox._config import SandboxConfig
-
-
-# _KeyStrength():
-#
-# Strength of cache key
-#
-class _KeyStrength(Enum):
-
- # Includes strong cache keys of all build dependencies and their
- # runtime dependencies.
- STRONG = 1
-
- # Includes names of direct build dependencies but does not include
- # cache keys of dependencies.
- WEAK = 2
+from .types import _KeyStrength, CoreWarnings
class Scope(Enum):
diff --git a/buildstream/plugin.py b/buildstream/plugin.py
index 8fbac365a..f2785349f 100644
--- a/buildstream/plugin.py
+++ b/buildstream/plugin.py
@@ -119,6 +119,7 @@ from . import _yaml
from . import utils
from ._exceptions import PluginError, ImplError
from ._message import Message, MessageType
+from .types import CoreWarnings
class Plugin():
@@ -817,25 +818,8 @@ class Plugin():
return self.name
-class CoreWarnings():
- """CoreWarnings()
-
- Some common warnings which are raised by core functionalities within BuildStream are found in this class.
- """
-
- OVERLAPS = "overlaps"
- """
- This warning will be produced when buildstream detects an overlap on an element
- which is not whitelisted. See :ref:`Overlap Whitelist <public_overlap_whitelist>`
- """
-
- REF_NOT_IN_TRACK = "ref-not-in-track"
- """
- This warning will be produced when a source is configured with a reference
- which is found to be invalid based on the configured track
- """
-
-
+# A local table for _prefix_warning()
+#
__CORE_WARNINGS = [
value
for name, value in CoreWarnings.__dict__.items()
diff --git a/buildstream/plugins/sources/git.py b/buildstream/plugins/sources/git.py
index a44717a35..29a148431 100644
--- a/buildstream/plugins/sources/git.py
+++ b/buildstream/plugins/sources/git.py
@@ -108,9 +108,8 @@ from io import StringIO
from configparser import RawConfigParser
-from buildstream import Source, SourceError, Consistency, SourceFetcher
+from buildstream import Source, SourceError, Consistency, SourceFetcher, CoreWarnings
from buildstream import utils
-from buildstream.plugin import CoreWarnings
GIT_MODULES = '.gitmodules'
diff --git a/buildstream/types.py b/buildstream/types.py
index d54bf0b6e..f528aca97 100644
--- a/buildstream/types.py
+++ b/buildstream/types.py
@@ -113,6 +113,31 @@ class CoreWarnings():
"""
+class CoreWarnings():
+ """CoreWarnings()
+
+ Some common warnings which are raised by core functionalities within BuildStream are found in this class.
+ """
+
+ OVERLAPS = "overlaps"
+ """
+ This warning will be produced when buildstream detects an overlap on an element
+ which is not whitelisted. See :ref:`Overlap Whitelist <public_overlap_whitelist>`
+ """
+
+ REF_NOT_IN_TRACK = "ref-not-in-track"
+ """
+ This warning will be produced when a source is configured with a reference
+ which is found to be invalid based on the configured track
+ """
+
+ BAD_ELEMENT_SUFFIX = "bad-element-suffix"
+ """
+ This warning will be produced when an element whose name does not end in .bst
+ is referenced either on the command line or by another element
+ """
+
+
# _KeyStrength():
#
# Strength of cache key
diff --git a/doc/source/format_project.rst b/doc/source/format_project.rst
index 1d55bd7e9..3462a4d16 100644
--- a/doc/source/format_project.rst
+++ b/doc/source/format_project.rst
@@ -143,7 +143,7 @@ Individual warnings can be configured as fatal by setting ``fatal-warnings`` to
- ref-not-in-track
- <plugin>:<warning>
-BuildStream provides a collection of :class:`Core Warnings <buildstream.plugin.CoreWarnings>` which may be raised
+BuildStream provides a collection of :class:`Core Warnings <buildstream.types.CoreWarnings>` which may be raised
by a variety of plugins. Other configurable warnings are plugin specific and should be noted within their individual documentation.
.. note::