Tristan Van Berkom pushed to branch master at BuildStream / buildstream
Commits:
-
4f0bfb4a
by Tristan Van Berkom at 2018-10-11T15:37:51Z
-
9dc10cc7
by Tristan Van Berkom at 2018-10-11T15:45:36Z
-
efc0d4cc
by Tristan Van Berkom at 2018-10-11T15:48:44Z
-
a0712ead
by Tristan Van Berkom at 2018-10-11T16:23:54Z
6 changed files:
- buildstream/__init__.py
- buildstream/_artifactcache/artifactcache.py
- buildstream/element.py
- buildstream/source.py
- buildstream/element_enums.py → buildstream/types.py
- doc/source/core_framework.rst
Changes:
... | ... | @@ -28,9 +28,9 @@ if "_BST_COMPLETION" not in os.environ: |
28 | 28 |
|
29 | 29 |
from .utils import UtilError, ProgramNotFoundError
|
30 | 30 |
from .sandbox import Sandbox, SandboxFlags
|
31 |
+ from .types import Scope, Consistency
|
|
31 | 32 |
from .plugin import Plugin
|
32 |
- from .source import Source, SourceError, Consistency, SourceFetcher
|
|
33 |
+ from .source import Source, SourceError, SourceFetcher
|
|
33 | 34 |
from .element import Element, ElementError
|
34 |
- from .element_enums import Scope
|
|
35 | 35 |
from .buildelement import BuildElement
|
36 | 36 |
from .scriptelement import ScriptElement
|
... | ... | @@ -21,7 +21,7 @@ import os |
21 | 21 |
import string
|
22 | 22 |
from collections import Mapping, namedtuple
|
23 | 23 |
|
24 |
-from ..element_enums import _KeyStrength
|
|
24 |
+from ..types import _KeyStrength
|
|
25 | 25 |
from .._exceptions import ArtifactError, ImplError, LoadError, LoadErrorReason
|
26 | 26 |
from .._message import Message, MessageType
|
27 | 27 |
from .. import utils
|
... | ... | @@ -86,7 +86,7 @@ from ._variables import Variables |
86 | 86 |
from ._versions import BST_CORE_ARTIFACT_VERSION
|
87 | 87 |
from ._exceptions import BstError, LoadError, LoadErrorReason, ImplError, ErrorDomain
|
88 | 88 |
from .utils import UtilError
|
89 |
-from . import Plugin, Consistency
|
|
89 |
+from . import Plugin, Consistency, Scope
|
|
90 | 90 |
from . import SandboxFlags
|
91 | 91 |
from . import utils
|
92 | 92 |
from . import _cachekey
|
... | ... | @@ -96,11 +96,11 @@ from ._platform import Platform |
96 | 96 |
from .plugin import CoreWarnings
|
97 | 97 |
from .sandbox._config import SandboxConfig
|
98 | 98 |
from .sandbox._sandboxremote import SandboxRemote
|
99 |
+from .types import _KeyStrength
|
|
99 | 100 |
|
100 | 101 |
from .storage.directory import Directory
|
101 | 102 |
from .storage._filebaseddirectory import FileBasedDirectory
|
102 | 103 |
from .storage.directory import VirtualDirectoryError
|
103 |
-from .element_enums import _KeyStrength, Scope
|
|
104 | 104 |
|
105 | 105 |
|
106 | 106 |
class ElementError(BstError):
|
... | ... | @@ -145,35 +145,12 @@ import os |
145 | 145 |
from collections import Mapping
|
146 | 146 |
from contextlib import contextmanager
|
147 | 147 |
|
148 |
-from . import Plugin
|
|
148 |
+from . import Plugin, Consistency
|
|
149 | 149 |
from . import _yaml, utils
|
150 | 150 |
from ._exceptions import BstError, ImplError, ErrorDomain
|
151 | 151 |
from ._projectrefs import ProjectRefStorage
|
152 | 152 |
|
153 | 153 |
|
154 |
-class Consistency():
|
|
155 |
- INCONSISTENT = 0
|
|
156 |
- """Inconsistent
|
|
157 |
- |
|
158 |
- Inconsistent sources have no explicit reference set. They cannot
|
|
159 |
- produce a cache key, be fetched or staged. They can only be tracked.
|
|
160 |
- """
|
|
161 |
- |
|
162 |
- RESOLVED = 1
|
|
163 |
- """Resolved
|
|
164 |
- |
|
165 |
- Resolved sources have a reference and can produce a cache key and
|
|
166 |
- be fetched, however they cannot be staged.
|
|
167 |
- """
|
|
168 |
- |
|
169 |
- CACHED = 2
|
|
170 |
- """Cached
|
|
171 |
- |
|
172 |
- Cached sources have a reference which is present in the local
|
|
173 |
- source cache. Only cached sources can be staged.
|
|
174 |
- """
|
|
175 |
- |
|
176 |
- |
|
177 | 154 |
class SourceError(BstError):
|
178 | 155 |
"""This exception should be raised by :class:`.Source` implementations
|
179 | 156 |
to report errors to the user.
|
... | ... | @@ -19,31 +19,19 @@ |
19 | 19 |
# Jim MacArthur <jim macarthur codethink co uk>
|
20 | 20 |
|
21 | 21 |
"""
|
22 |
-Element - Globally visible enumerations
|
|
23 |
-=======================================
|
|
22 |
+Foundation types
|
|
23 |
+================
|
|
24 | 24 |
|
25 | 25 |
"""
|
26 | 26 |
|
27 | 27 |
from enum import Enum
|
28 | 28 |
|
29 | 29 |
|
30 |
-# _KeyStrength():
|
|
31 |
-#
|
|
32 |
-# Strength of cache key
|
|
33 |
-#
|
|
34 |
-class _KeyStrength(Enum):
|
|
35 |
- |
|
36 |
- # Includes strong cache keys of all build dependencies and their
|
|
37 |
- # runtime dependencies.
|
|
38 |
- STRONG = 1
|
|
39 |
- |
|
40 |
- # Includes names of direct build dependencies but does not include
|
|
41 |
- # cache keys of dependencies.
|
|
42 |
- WEAK = 2
|
|
43 |
- |
|
44 |
- |
|
45 | 30 |
class Scope(Enum):
|
46 |
- """Types of scope for a given element"""
|
|
31 |
+ """Defines the scope of dependencies to include for a given element
|
|
32 |
+ when iterating over the dependency graph in APIs like
|
|
33 |
+ :func:`Element.dependencies() <buildstream.element.Element.dependencies>`
|
|
34 |
+ """
|
|
47 | 35 |
|
48 | 36 |
ALL = 1
|
49 | 37 |
"""All elements which the given element depends on, following
|
... | ... | @@ -59,3 +47,44 @@ class Scope(Enum): |
59 | 47 |
"""All elements required for running the element. Including the element
|
60 | 48 |
itself.
|
61 | 49 |
"""
|
50 |
+ |
|
51 |
+ |
|
52 |
+class Consistency():
|
|
53 |
+ """Defines the various consistency states of a :class:`.Source`.
|
|
54 |
+ """
|
|
55 |
+ |
|
56 |
+ INCONSISTENT = 0
|
|
57 |
+ """Inconsistent
|
|
58 |
+ |
|
59 |
+ Inconsistent sources have no explicit reference set. They cannot
|
|
60 |
+ produce a cache key, be fetched or staged. They can only be tracked.
|
|
61 |
+ """
|
|
62 |
+ |
|
63 |
+ RESOLVED = 1
|
|
64 |
+ """Resolved
|
|
65 |
+ |
|
66 |
+ Resolved sources have a reference and can produce a cache key and
|
|
67 |
+ be fetched, however they cannot be staged.
|
|
68 |
+ """
|
|
69 |
+ |
|
70 |
+ CACHED = 2
|
|
71 |
+ """Cached
|
|
72 |
+ |
|
73 |
+ Cached sources have a reference which is present in the local
|
|
74 |
+ source cache. Only cached sources can be staged.
|
|
75 |
+ """
|
|
76 |
+ |
|
77 |
+ |
|
78 |
+# _KeyStrength():
|
|
79 |
+#
|
|
80 |
+# Strength of cache key
|
|
81 |
+#
|
|
82 |
+class _KeyStrength(Enum):
|
|
83 |
+ |
|
84 |
+ # Includes strong cache keys of all build dependencies and their
|
|
85 |
+ # runtime dependencies.
|
|
86 |
+ STRONG = 1
|
|
87 |
+ |
|
88 |
+ # Includes names of direct build dependencies but does not include
|
|
89 |
+ # cache keys of dependencies.
|
|
90 |
+ WEAK = 2
|
... | ... | @@ -12,6 +12,7 @@ useful for working on BuildStream itself. |
12 | 12 |
.. toctree::
|
13 | 13 |
:maxdepth: 1
|
14 | 14 |
|
15 |
+ buildstream.types
|
|
15 | 16 |
buildstream.plugin
|
16 | 17 |
buildstream.source
|
17 | 18 |
buildstream.element
|