summaryrefslogtreecommitdiff
path: root/buildstream
diff options
context:
space:
mode:
Diffstat (limited to 'buildstream')
-rw-r--r--buildstream/__init__.py2
-rw-r--r--buildstream/_loader/loader.py2
-rw-r--r--buildstream/_project.py2
-rw-r--r--buildstream/element.py3
-rw-r--r--buildstream/plugin.py60
-rw-r--r--buildstream/plugins/sources/git.py3
-rw-r--r--buildstream/types.py25
7 files changed, 49 insertions, 48 deletions
diff --git a/buildstream/__init__.py b/buildstream/__init__.py
index fc09f2812..baacc480b 100644
--- a/buildstream/__init__.py
+++ b/buildstream/__init__.py
@@ -28,7 +28,7 @@ if "_BST_COMPLETION" not in os.environ:
from .utils import UtilError, ProgramNotFoundError
from .sandbox import Sandbox, SandboxFlags, SandboxCommandError
- from .types import Scope, Consistency
+ from .types import Scope, Consistency, CoreWarnings
from .plugin import Plugin
from .source import Source, SourceError, SourceFetcher
from .element import Element, ElementError
diff --git a/buildstream/_loader/loader.py b/buildstream/_loader/loader.py
index a172a10c8..0de0e2b9c 100644
--- a/buildstream/_loader/loader.py
+++ b/buildstream/_loader/loader.py
@@ -36,7 +36,7 @@ from .types import Symbol, Dependency
from .loadelement import LoadElement
from . import MetaElement
from . import MetaSource
-from ..plugin import CoreWarnings
+from ..types import CoreWarnings
from .._message import Message, MessageType
diff --git a/buildstream/_project.py b/buildstream/_project.py
index 52408b7e5..386036488 100644
--- a/buildstream/_project.py
+++ b/buildstream/_project.py
@@ -33,7 +33,7 @@ from ._artifactcache import ArtifactCache
from .sandbox import SandboxRemote
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 27677b054..ed279458c 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -96,10 +96,9 @@ from . import _cachekey
from . import _signals
from . import _site
from ._platform import Platform
-from .plugin import CoreWarnings
from .sandbox._config import SandboxConfig
from .sandbox._sandboxremote import SandboxRemote
-from .types import _KeyStrength
+from .types import _KeyStrength, CoreWarnings
from .storage.directory import Directory
from .storage._filebaseddirectory import FileBasedDirectory
diff --git a/buildstream/plugin.py b/buildstream/plugin.py
index 37dd78cc8..1e8dd4b9f 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():
@@ -766,38 +767,6 @@ 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
- """
-
- 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
- """
-
-
-__CORE_WARNINGS = [
- value
- for name, value in CoreWarnings.__dict__.items()
- if not name.startswith("__")
-]
-
-
# Hold on to a lookup table by counter of all instantiated plugins.
# We use this to send the id back from child processes so we can lookup
# corresponding element/source in the master process.
@@ -828,6 +797,24 @@ def _plugin_lookup(unique_id):
return __PLUGINS_TABLE[unique_id]
+# No need for unregister, WeakValueDictionary() will remove entries
+# in itself when the referenced plugins are garbage collected.
+def _plugin_register(plugin):
+ global __PLUGINS_UNIQUE_ID # pylint: disable=global-statement
+ __PLUGINS_UNIQUE_ID += 1
+ __PLUGINS_TABLE[__PLUGINS_UNIQUE_ID] = plugin
+ return __PLUGINS_UNIQUE_ID
+
+
+# A local table for _prefix_warning()
+#
+__CORE_WARNINGS = [
+ value
+ for name, value in CoreWarnings.__dict__.items()
+ if not name.startswith("__")
+]
+
+
# _prefix_warning():
#
# Prefix a warning with the plugin kind. CoreWarnings are not prefixed.
@@ -843,12 +830,3 @@ def _prefix_warning(plugin, warning):
if any((warning is core_warning for core_warning in __CORE_WARNINGS)):
return warning
return "{}:{}".format(plugin.get_kind(), warning)
-
-
-# No need for unregister, WeakValueDictionary() will remove entries
-# in itself when the referenced plugins are garbage collected.
-def _plugin_register(plugin):
- global __PLUGINS_UNIQUE_ID # pylint: disable=global-statement
- __PLUGINS_UNIQUE_ID += 1
- __PLUGINS_TABLE[__PLUGINS_UNIQUE_ID] = plugin
- return __PLUGINS_UNIQUE_ID
diff --git a/buildstream/plugins/sources/git.py b/buildstream/plugins/sources/git.py
index e3dded1d4..112b72827 100644
--- a/buildstream/plugins/sources/git.py
+++ b/buildstream/plugins/sources/git.py
@@ -149,9 +149,8 @@ from tempfile import TemporaryFile
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
from buildstream.utils import move_atomic, DirectoryExistsError
GIT_MODULES = '.gitmodules'
diff --git a/buildstream/types.py b/buildstream/types.py
index 3eb4a9110..5e6265b4e 100644
--- a/buildstream/types.py
+++ b/buildstream/types.py
@@ -81,6 +81,31 @@ class Consistency():
"""
+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