summaryrefslogtreecommitdiff
path: root/src/buildstream/_artifact.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildstream/_artifact.py')
-rw-r--r--src/buildstream/_artifact.py47
1 files changed, 11 insertions, 36 deletions
diff --git a/src/buildstream/_artifact.py b/src/buildstream/_artifact.py
index a06b189ed..1feda2246 100644
--- a/src/buildstream/_artifact.py
+++ b/src/buildstream/_artifact.py
@@ -61,18 +61,10 @@ class Artifact:
self._tmpdir = context.tmpdir
self._proto = None
- self._metadata_keys = (
- None # Strong and weak key tuple extracted from the artifact
- )
- self._metadata_dependencies = (
- None # Dictionary of dependency strong keys from the artifact
- )
- self._metadata_workspaced = (
- None # Boolean of whether it's a workspaced artifact
- )
- self._metadata_workspaced_dependencies = (
- None # List of which dependencies are workspaced from the artifact
- )
+ self._metadata_keys = None # Strong and weak key tuple extracted from the artifact
+ self._metadata_dependencies = None # Dictionary of dependency strong keys from the artifact
+ self._metadata_workspaced = None # Boolean of whether it's a workspaced artifact
+ self._metadata_workspaced_dependencies = None # List of which dependencies are workspaced from the artifact
self._cached = None # Boolean of whether the artifact is cached
# get_files():
@@ -202,10 +194,7 @@ class Artifact:
size += buildtreevdir.get_size()
os.makedirs(
- os.path.dirname(
- os.path.join(self._artifactdir, element.get_artifact_name())
- ),
- exist_ok=True,
+ os.path.dirname(os.path.join(self._artifactdir, element.get_artifact_name())), exist_ok=True,
)
keys = utils._deduplicate([self._cache_key, self._weak_cache_key])
for key in keys:
@@ -321,9 +310,7 @@ class Artifact:
# Extract proto
artifact = self._get_proto()
- self._metadata_dependencies = {
- dep.element_name: dep.cache_key for dep in artifact.build_deps
- }
+ self._metadata_dependencies = {dep.element_name: dep.cache_key for dep in artifact.build_deps}
return self._metadata_dependencies
@@ -388,11 +375,7 @@ class Artifact:
if deps == Scope.BUILD:
try:
dependency_refs = [
- os.path.join(
- dep.project_name,
- _get_normal_name(dep.element_name),
- dep.cache_key,
- )
+ os.path.join(dep.project_name, _get_normal_name(dep.element_name), dep.cache_key,)
for dep in artifact.build_deps
]
except AttributeError:
@@ -410,9 +393,7 @@ class Artifact:
# 1. It might trigger unnecessary rebuilds.
# 2. It would be impossible to support cyclic runtime dependencies
# in the future
- raise ArtifactError(
- "Dependency scope: {} is not supported for artifacts".format(deps)
- )
+ raise ArtifactError("Dependency scope: {} is not supported for artifacts".format(deps))
return dependency_refs
@@ -442,17 +423,13 @@ class Artifact:
# Determine whether directories are required
require_directories = context.require_artifact_directories
# Determine whether file contents are required as well
- require_files = (
- context.require_artifact_files or self._element._artifact_files_required()
- )
+ require_files = context.require_artifact_files or self._element._artifact_files_required()
# Check whether 'files' subdirectory is available, with or without file contents
if (
require_directories
and str(artifact.files)
- and not self._cas.contains_directory(
- artifact.files, with_files=require_files
- )
+ and not self._cas.contains_directory(artifact.files, with_files=require_files)
):
self._cached = False
return False
@@ -500,9 +477,7 @@ class Artifact:
key = self.get_extract_key()
- proto_path = os.path.join(
- self._artifactdir, self._element.get_artifact_name(key=key)
- )
+ proto_path = os.path.join(self._artifactdir, self._element.get_artifact_name(key=key))
artifact = ArtifactProto()
try:
with open(proto_path, mode="r+b") as f: