diff options
30 files changed, 91 insertions, 91 deletions
diff --git a/.gitignore b/.gitignore index fae0f4eea..8c72c4f3f 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,4 @@ doc/source/modules.rst doc/source/buildstream.rst doc/source/buildstream.*.rst doc/build/ +versioneer.pyc diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 07fa859d8..02a803de4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -image: buildstream/testsuite-debian:9-master-114-4cab18e3 +image: buildstream/testsuite-debian:9-master-119-552f5fc6 cache: key: "$CI_JOB_NAME-" @@ -78,7 +78,7 @@ source_dist: # Go back to the toplevel and collect our reports - cd ../.. - mkdir -p coverage-linux/ - - cp dist/buildstream/.coverage.* coverage-linux/coverage."${CI_JOB_NAME}" + - cp dist/buildstream/.coverage coverage-linux/coverage."${CI_JOB_NAME}" except: - schedules artifacts: @@ -86,25 +86,25 @@ source_dist: - coverage-linux/ tests-debian-9: - image: buildstream/testsuite-debian:9-master-117-aa3a33b3 + image: buildstream/testsuite-debian:9-master-119-552f5fc6 <<: *linux-tests tests-fedora-27: - image: buildstream/testsuite-fedora:27-master-117-aa3a33b3 + image: buildstream/testsuite-fedora:27-master-119-552f5fc6 <<: *linux-tests tests-fedora-28: - image: buildstream/testsuite-fedora:28-master-117-aa3a33b3 + image: buildstream/testsuite-fedora:28-master-119-552f5fc6 <<: *linux-tests tests-ubuntu-18.04: - image: buildstream/testsuite-ubuntu:18.04-master-117-aa3a33b3 + image: buildstream/testsuite-ubuntu:18.04-master-119-552f5fc6 <<: *linux-tests tests-unix: # Use fedora here, to a) run a test on fedora and b) ensure that we # can get rid of ostree - this is not possible with debian-8 - image: buildstream/testsuite-fedora:27-master-117-aa3a33b3 + image: buildstream/testsuite-fedora:27-master-119-552f5fc6 stage: test variables: BST_FORCE_BACKEND: "unix" @@ -128,7 +128,7 @@ tests-unix: # Go back to the toplevel and collect our reports - cd ../.. - mkdir -p coverage-unix/ - - cp dist/buildstream/.coverage.* coverage-unix/coverage.unix + - cp dist/buildstream/.coverage coverage-unix/coverage.unix except: - schedules artifacts: diff --git a/MANIFEST.in b/MANIFEST.in index 9c16ce051..5c001616a 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -8,19 +8,27 @@ include README.rst # Documentation package includes include doc/Makefile +include doc/badges.py +include doc/bst2html.py include doc/source/conf.py -include doc/source/index.rst +include doc/source/plugin.rsttemplate +recursive-include doc/source *.rst +recursive-include doc/source *.py +recursive-include doc/source *.in +recursive-include doc/source *.html +recursive-include doc/examples * # Tests -recursive-include tests *.py -recursive-include tests *.yaml -recursive-include tests *.bst -recursive-include tests *.conf -recursive-include tests *.sh -recursive-include tests *.expected +recursive-include tests * +include conftest.py +include .coveragerc +include .pylintrc # Protocol Buffers recursive-include buildstream/_protos *.proto # Requirements files include dev-requirements.txt + +# Versioneer +include versioneer.py diff --git a/buildstream/_artifactcache/artifactcache.py b/buildstream/_artifactcache/artifactcache.py index 5e698babb..8ea6c9dc2 100644 --- a/buildstream/_artifactcache/artifactcache.py +++ b/buildstream/_artifactcache/artifactcache.py @@ -156,7 +156,7 @@ class ArtifactCache(): def setup_remotes(self, *, use_config=False, remote_url=None): # Ensure we do not double-initialise since this can be expensive - assert(not self._remotes_setup) + assert not self._remotes_setup self._remotes_setup = True # Initialize remote artifact caches. We allow the commandline to override @@ -252,7 +252,7 @@ class ArtifactCache(): # (int): The size of the cache after having cleaned up # def clean(self): - artifacts = self.list_artifacts() + artifacts = self.list_artifacts() # pylint: disable=assignment-from-no-return # Build a set of the cache keys which are required # based on the required elements at cleanup time @@ -294,7 +294,7 @@ class ArtifactCache(): if key not in required_artifacts: # Remove the actual artifact, if it's not required. - size = self.remove(to_remove) + size = self.remove(to_remove) # pylint: disable=assignment-from-no-return # Remove the size from the removed size self.set_cache_size(self._cache_size - size) @@ -311,7 +311,7 @@ class ArtifactCache(): # (int): The size of the artifact cache. # def compute_cache_size(self): - self._cache_size = self.calculate_cache_size() + self._cache_size = self.calculate_cache_size() # pylint: disable=assignment-from-no-return return self._cache_size diff --git a/buildstream/_artifactcache/cascache.py b/buildstream/_artifactcache/cascache.py index 2454366ac..b99f4d7b8 100644 --- a/buildstream/_artifactcache/cascache.py +++ b/buildstream/_artifactcache/cascache.py @@ -33,11 +33,11 @@ import grpc from .. import _yaml +from .._protos.google.rpc import code_pb2 from .._protos.google.bytestream import bytestream_pb2, bytestream_pb2_grpc from .._protos.build.bazel.remote.execution.v2 import remote_execution_pb2, remote_execution_pb2_grpc from .._protos.buildstream.v2 import buildstream_pb2, buildstream_pb2_grpc -from .._message import MessageType, Message from .. import _signals, utils from .._exceptions import ArtifactError @@ -81,8 +81,9 @@ class CASCache(ArtifactCache): ################################################ def preflight(self): - if (not os.path.isdir(os.path.join(self.casdir, 'refs', 'heads')) or - not os.path.isdir(os.path.join(self.casdir, 'objects'))): + headdir = os.path.join(self.casdir, 'refs', 'heads') + objdir = os.path.join(self.casdir, 'objects') + if not (os.path.isdir(headdir) and os.path.isdir(objdir)): raise ArtifactError("CAS repository check failed for '{}'" .format(self.casdir)) @@ -918,7 +919,7 @@ class CASCache(ArtifactCache): # Skip download, already in local cache. pass elif (digest.size_bytes >= remote.max_batch_total_size_bytes or - not remote.batch_read_supported): + not remote.batch_read_supported): # Too large for batch request, download in independent request. self._ensure_blob(remote, digest) in_local_cache = True @@ -958,7 +959,7 @@ class CASCache(ArtifactCache): batch = _CASBatchRead(remote) while len(fetch_queue) + len(fetch_next_queue) > 0: - if len(fetch_queue) == 0: + if not fetch_queue: batch = self._fetch_directory_batch(remote, batch, fetch_queue, fetch_next_queue) dir_digest = fetch_queue.pop(0) @@ -1087,6 +1088,10 @@ class _CASRemote(): self.bytestream = None self.cas = None self.ref_storage = None + self.batch_update_supported = None + self.batch_read_supported = None + self.capabilities = None + self.max_batch_total_size_bytes = None def init(self): if not self._initialized: @@ -1191,13 +1196,13 @@ class _CASBatchRead(): assert not self._sent self._sent = True - if len(self._request.digests) == 0: + if not self._request.digests: return batch_response = self._remote.cas.BatchReadBlobs(self._request) for response in batch_response.responses: - if response.status.code != grpc.StatusCode.OK.value[0]: + if response.status.code != code_pb2.OK: raise ArtifactError("Failed to download blob {}: {}".format( response.digest.hash, response.status.code)) if response.digest.size_bytes != len(response.data): @@ -1236,13 +1241,13 @@ class _CASBatchUpdate(): assert not self._sent self._sent = True - if len(self._request.requests) == 0: + if not self._request.requests: return batch_response = self._remote.cas.BatchUpdateBlobs(self._request) for response in batch_response.responses: - if response.status.code != grpc.StatusCode.OK.value[0]: + if response.status.code != code_pb2.OK: raise ArtifactError("Failed to upload blob {}: {}".format( response.digest.hash, response.status.code)) diff --git a/buildstream/_context.py b/buildstream/_context.py index d2086af93..e3c290b7b 100644 --- a/buildstream/_context.py +++ b/buildstream/_context.py @@ -364,7 +364,6 @@ class Context(): assert self._message_handler self._message_handler(message, context=self) - return # silence() # diff --git a/buildstream/_frontend/app.py b/buildstream/_frontend/app.py index f3dcd623b..eeb5f3eb2 100644 --- a/buildstream/_frontend/app.py +++ b/buildstream/_frontend/app.py @@ -20,7 +20,6 @@ from contextlib import contextmanager import os import sys -import resource import traceback import datetime from textwrap import TextWrapper diff --git a/buildstream/_frontend/status.py b/buildstream/_frontend/status.py index fd1a5acf1..2e7213e78 100644 --- a/buildstream/_frontend/status.py +++ b/buildstream/_frontend/status.py @@ -18,8 +18,8 @@ # Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> import os import sys -import click import curses +import click # Import a widget internal for formatting time codes from .widget import TimeCode diff --git a/buildstream/_fuse/hardlinks.py b/buildstream/_fuse/hardlinks.py index 0797cb4bc..ff2e81eea 100644 --- a/buildstream/_fuse/hardlinks.py +++ b/buildstream/_fuse/hardlinks.py @@ -42,9 +42,11 @@ from .mount import Mount # class SafeHardlinks(Mount): - def __init__(self, directory, tempdir, fuse_mount_options={}): + def __init__(self, directory, tempdir, fuse_mount_options=None): self.directory = directory self.tempdir = tempdir + if fuse_mount_options is None: + fuse_mount_options = {} super().__init__(fuse_mount_options=fuse_mount_options) def create_operations(self): diff --git a/buildstream/_fuse/mount.py b/buildstream/_fuse/mount.py index 83c98a97a..e31684100 100644 --- a/buildstream/_fuse/mount.py +++ b/buildstream/_fuse/mount.py @@ -87,8 +87,8 @@ class Mount(): # User Facing API # ################################################ - def __init__(self, fuse_mount_options={}): - self._fuse_mount_options = fuse_mount_options + def __init__(self, fuse_mount_options=None): + self._fuse_mount_options = {} if fuse_mount_options is None else fuse_mount_options # mount(): # @@ -182,7 +182,7 @@ class Mount(): # Ask the subclass to give us an Operations object # - self.__operations = self.create_operations() + self.__operations = self.create_operations() # pylint: disable=assignment-from-no-return # Run fuse in foreground in this child process, internally libfuse # will handle SIGTERM and gracefully exit its own little main loop. diff --git a/buildstream/_options/optionbool.py b/buildstream/_options/optionbool.py index ffef55ca1..867de22df 100644 --- a/buildstream/_options/optionbool.py +++ b/buildstream/_options/optionbool.py @@ -43,9 +43,9 @@ class OptionBool(Option): self.value = _yaml.node_get(node, bool, self.name) def set_value(self, value): - if value == 'True' or value == 'true': + if value in ('True', 'true'): self.value = True - elif value == 'False' or value == 'false': + elif value in ('False', 'false'): self.value = False else: raise LoadError(LoadErrorReason.INVALID_DATA, diff --git a/buildstream/_platform/darwin.py b/buildstream/_platform/darwin.py index 04a83110e..292c0cb73 100644 --- a/buildstream/_platform/darwin.py +++ b/buildstream/_platform/darwin.py @@ -16,9 +16,7 @@ # License along with this library. If not, see <http://www.gnu.org/licenses/>. import os -import resource -from .._exceptions import PlatformError from ..sandbox import SandboxDummy from . import Platform @@ -29,10 +27,6 @@ class Darwin(Platform): # This value comes from OPEN_MAX in syslimits.h OPEN_MAX = 10240 - def __init__(self): - - super().__init__() - def create_sandbox(self, *args, **kwargs): kwargs['dummy_reason'] = \ "OSXFUSE is not supported and there are no supported sandbox" + \ diff --git a/buildstream/_platform/linux.py b/buildstream/_platform/linux.py index 09db19f2d..6e488472f 100644 --- a/buildstream/_platform/linux.py +++ b/buildstream/_platform/linux.py @@ -22,7 +22,6 @@ import subprocess from .. import _site from .. import utils -from .._message import Message, MessageType from ..sandbox import SandboxDummy from . import Platform @@ -112,8 +111,4 @@ class Linux(Platform): except subprocess.CalledProcessError: output = '' - if output == 'root': - return True - - else: - return False + return output == 'root' diff --git a/buildstream/_scheduler/jobs/job.py b/buildstream/_scheduler/jobs/job.py index a1b90a080..60ae0d001 100644 --- a/buildstream/_scheduler/jobs/job.py +++ b/buildstream/_scheduler/jobs/job.py @@ -414,7 +414,7 @@ class Job(): try: # Try the task action - result = self.child_process() + result = self.child_process() # pylint: disable=assignment-from-no-return except SkipJob as e: elapsed = datetime.datetime.now() - starttime self.message(MessageType.SKIPPED, str(e), diff --git a/buildstream/_scheduler/queues/pullqueue.py b/buildstream/_scheduler/queues/pullqueue.py index 2842c5e21..b861373a9 100644 --- a/buildstream/_scheduler/queues/pullqueue.py +++ b/buildstream/_scheduler/queues/pullqueue.py @@ -57,7 +57,7 @@ class PullQueue(Queue): def done(self, _, element, result, success): if not success: - return False + return element._pull_done() diff --git a/buildstream/_scheduler/queues/trackqueue.py b/buildstream/_scheduler/queues/trackqueue.py index 133655e14..514418086 100644 --- a/buildstream/_scheduler/queues/trackqueue.py +++ b/buildstream/_scheduler/queues/trackqueue.py @@ -20,7 +20,6 @@ # BuildStream toplevel imports from ...plugin import _plugin_lookup -from ... import SourceError # Local imports from . import Queue, QueueStatus diff --git a/buildstream/_variables.py b/buildstream/_variables.py index 1a52b5680..95b80cc08 100644 --- a/buildstream/_variables.py +++ b/buildstream/_variables.py @@ -191,8 +191,8 @@ def find_recursive_variable(variable, matched_variables, all_vars): for key, value in zip(matched_variables, matched_values): if _wrap_variable(variable) in value: return key - else: - return None + # We failed to find a recursive variable + return None def _wrap_variable(var): diff --git a/buildstream/_workspaces.py b/buildstream/_workspaces.py index adffaa694..468073f05 100644 --- a/buildstream/_workspaces.py +++ b/buildstream/_workspaces.py @@ -367,7 +367,7 @@ class Workspaces(): for element, config in _yaml.node_items(workspaces) } - elif version >= 1 and version <= BST_WORKSPACE_FORMAT_VERSION: + elif 1 <= version <= BST_WORKSPACE_FORMAT_VERSION: workspaces = _yaml.node_get(workspaces, dict, "workspaces", default_value={}) res = {element: self._load_workspace(node) for element, node in _yaml.node_items(workspaces)} diff --git a/buildstream/_yaml.py b/buildstream/_yaml.py index 30fc77291..90784636d 100644 --- a/buildstream/_yaml.py +++ b/buildstream/_yaml.py @@ -395,9 +395,9 @@ def node_get(node, expected_type, key, indices=None, default_value=_get_sentinel try: if (expected_type == bool and isinstance(value, str)): # Dont coerce booleans to string, this makes "False" strings evaluate to True - if value == 'true' or value == 'True': + if value in ('True', 'true'): value = True - elif value == 'false' or value == 'False': + elif value in ('False', 'false'): value = False else: raise ValueError() @@ -470,10 +470,11 @@ def node_get_project_path(node, key, project_dir, *, .format(provenance, path_str)) try: + full_path = (project_dir_path / path) if sys.version_info[0] == 3 and sys.version_info[1] < 6: - full_resolved_path = (project_dir_path / path).resolve() + full_resolved_path = full_path.resolve() else: - full_resolved_path = (project_dir_path / path).resolve(strict=True) + full_resolved_path = full_path.resolve(strict=True) # pylint: disable=unexpected-keyword-arg except FileNotFoundError: raise LoadError(LoadErrorReason.MISSING_FILE, "{}: Specified path '{}' does not exist" diff --git a/buildstream/_yamlcache.py b/buildstream/_yamlcache.py index 39b24cccc..6c3b4d639 100644 --- a/buildstream/_yamlcache.py +++ b/buildstream/_yamlcache.py @@ -27,9 +27,8 @@ import sys from contextlib import contextmanager from collections import namedtuple -from ._cachekey import generate_key from ._context import Context -from . import utils, _yaml +from . import _yaml YAML_CACHE_FILENAME = "yaml_cache.pickle" @@ -207,7 +206,7 @@ class YamlCache(): filepath = os.path.relpath(full_path, project.directory) else: filepath = full_path - return full_path + return filepath # _calculate_key(): # @@ -329,7 +328,7 @@ class BstUnpickler(pickle.Unpickler): if not project: projects = [p.name for p in self._context.get_projects()] raise pickle.UnpicklingError("No project with name {} found in {}" - .format(key_id, projects)) + .format(project_tag, projects)) else: project = None name = tagged_name diff --git a/buildstream/buildelement.py b/buildstream/buildelement.py index 3edc6d2a1..e57ca1c79 100644 --- a/buildstream/buildelement.py +++ b/buildstream/buildelement.py @@ -152,7 +152,7 @@ class BuildElement(Element): ############################################################# def configure(self, node): - self.__commands = {} + self.__commands = {} # pylint: disable=attribute-defined-outside-init # FIXME: Currently this forcefully validates configurations # for all BuildElement subclasses so they are unable to diff --git a/buildstream/element.py b/buildstream/element.py index de1988d2a..6536d2582 100644 --- a/buildstream/element.py +++ b/buildstream/element.py @@ -432,7 +432,7 @@ class Element(Plugin): visited=visited, recursed=True) # Yeild self only at the end, after anything needed has been traversed - if should_yield and (recurse or recursed) and (scope == Scope.ALL or scope == Scope.RUN): + if should_yield and (recurse or recursed) and (scope in (Scope.ALL, Scope.RUN)): yield self def search(self, scope, name): @@ -1563,7 +1563,7 @@ class Element(Plugin): # Step 3 - Prepare self.__prepare(sandbox) # Step 4 - Assemble - collect = self.assemble(sandbox) + collect = self.assemble(sandbox) # pylint: disable=assignment-from-no-return self.__set_build_result(success=True, description="succeeded") except BstError as e: # If an error occurred assembling an element in a sandbox, @@ -2521,7 +2521,7 @@ class Element(Plugin): strong_key = meta['strong'] weak_key = meta['weak'] - assert key == strong_key or key == weak_key + assert key in (strong_key, weak_key) self.__metadata_keys[strong_key] = meta self.__metadata_keys[weak_key] = meta diff --git a/buildstream/plugin.py b/buildstream/plugin.py index 65b1b6e9d..9c5c0d8ca 100644 --- a/buildstream/plugin.py +++ b/buildstream/plugin.py @@ -751,9 +751,7 @@ class Plugin(): self.__context.message(message) def __note_command(self, output, *popenargs, **kwargs): - workdir = os.getcwd() - if 'cwd' in kwargs: - workdir = kwargs['cwd'] + workdir = kwargs.get('cwd', os.getcwd()) command = " ".join(popenargs[0]) output.write('Running host command {}: {}\n'.format(workdir, command)) output.flush() diff --git a/buildstream/plugins/sources/git.py b/buildstream/plugins/sources/git.py index dbed87899..ced52d023 100644 --- a/buildstream/plugins/sources/git.py +++ b/buildstream/plugins/sources/git.py @@ -343,13 +343,13 @@ class GitMirror(SourceFetcher): '--contains', self.ref], cwd=fullpath,) if branch: - return True + return else: _, tag = self.source.check_output([self.source.host_git, 'tag', '--list', track, '--contains', self.ref], cwd=fullpath,) if tag: - return True + return detail = "The ref provided for the element does not exist locally in the provided track branch / tag " + \ "'{}'.\nYou may wish to track the element to update the ref from '{}' ".format(track, track) + \ diff --git a/buildstream/sandbox/_mount.py b/buildstream/sandbox/_mount.py index 2dc3df2b5..aff9e8a2d 100644 --- a/buildstream/sandbox/_mount.py +++ b/buildstream/sandbox/_mount.py @@ -30,7 +30,7 @@ from .._fuse import SafeHardlinks # Helper data object representing a single mount point in the mount map # class Mount(): - def __init__(self, sandbox, mount_point, safe_hardlinks, fuse_mount_options={}): + def __init__(self, sandbox, mount_point, safe_hardlinks, fuse_mount_options=None): scratch_directory = sandbox._get_scratch_directory() # Getting _get_underlying_directory() here is acceptable as # we're part of the sandbox code. This will fail if our @@ -39,7 +39,7 @@ class Mount(): self.mount_point = mount_point self.safe_hardlinks = safe_hardlinks - self._fuse_mount_options = fuse_mount_options + self._fuse_mount_options = {} if fuse_mount_options is None else fuse_mount_options # FIXME: When the criteria for mounting something and its parent # mount is identical, then there is no need to mount an additional @@ -101,10 +101,13 @@ class Mount(): # class MountMap(): - def __init__(self, sandbox, root_readonly, fuse_mount_options={}): + def __init__(self, sandbox, root_readonly, fuse_mount_options=None): # We will be doing the mounts in the order in which they were declared. self.mounts = OrderedDict() + if fuse_mount_options is None: + fuse_mount_options = {} + # We want safe hardlinks on rootfs whenever root is not readonly self.mounts['/'] = Mount(sandbox, '/', not root_readonly, fuse_mount_options) diff --git a/buildstream/sandbox/_mounter.py b/buildstream/sandbox/_mounter.py index 921d06bb6..e6054c20d 100644 --- a/buildstream/sandbox/_mounter.py +++ b/buildstream/sandbox/_mounter.py @@ -25,7 +25,7 @@ from .. import utils, _signals # A class to wrap the `mount` and `umount` system commands -class Mounter(object): +class Mounter(): @classmethod def _mount(cls, dest, src=None, mount_type=None, stdout=sys.stdout, stderr=sys.stderr, options=None, diff --git a/buildstream/sandbox/_sandboxbwrap.py b/buildstream/sandbox/_sandboxbwrap.py index 8c406e53e..fe429abe8 100644 --- a/buildstream/sandbox/_sandboxbwrap.py +++ b/buildstream/sandbox/_sandboxbwrap.py @@ -130,7 +130,7 @@ class SandboxBwrap(Sandbox): mount_source_overrides = self._get_mount_sources() for mark in marked_directories: mount_point = mark['directory'] - if mount_point in mount_source_overrides: + if mount_point in mount_source_overrides: # pylint: disable=consider-using-get mount_source = mount_source_overrides[mount_point] else: mount_source = mount_map.get_mount_source(mount_point) diff --git a/buildstream/sandbox/_sandboxchroot.py b/buildstream/sandbox/_sandboxchroot.py index f19052b23..aeba25137 100644 --- a/buildstream/sandbox/_sandboxchroot.py +++ b/buildstream/sandbox/_sandboxchroot.py @@ -72,7 +72,6 @@ class SandboxChroot(Sandbox): # each mount point needs to be mounted from and to self.mount_map = MountMap(self, flags & SandboxFlags.ROOT_READ_ONLY, self._FUSE_MOUNT_OPTIONS) - root_mount_source = self.mount_map.get_mount_source('/') # Create a sysroot and run the command inside it with ExitStack() as stack: @@ -147,7 +146,7 @@ class SandboxChroot(Sandbox): try: with _signals.suspendable(suspend_proc, resume_proc), _signals.terminator(kill_proc): - process = subprocess.Popen( + process = subprocess.Popen( # pylint: disable=subprocess-popen-preexec-fn command, close_fds=True, cwd=os.path.join(rootfs, cwd.lstrip(os.sep)), @@ -264,7 +263,7 @@ class SandboxChroot(Sandbox): @contextmanager def mount_point(point, **kwargs): mount_source_overrides = self._get_mount_sources() - if point in mount_source_overrides: + if point in mount_source_overrides: # pylint: disable=consider-using-get mount_source = mount_source_overrides[point] else: mount_source = self.mount_map.get_mount_source(point) diff --git a/buildstream/source.py b/buildstream/source.py index e42bad1a5..483fd2341 100644 --- a/buildstream/source.py +++ b/buildstream/source.py @@ -637,7 +637,7 @@ class Source(Plugin): # Source consistency interrogations are silent. context = self._get_context() with context.silence(): - self.__consistency = self.get_consistency() + self.__consistency = self.get_consistency() # pylint: disable=assignment-from-no-return # Return cached consistency # @@ -687,14 +687,14 @@ class Source(Plugin): key['directory'] = self.__directory if include_source: - key['unique'] = self.get_unique_key() + key['unique'] = self.get_unique_key() # pylint: disable=assignment-from-no-return return key # Wrapper for set_ref(), also returns whether it changed. # def _set_ref(self, ref, node): - current_ref = self.get_ref() + current_ref = self.get_ref() # pylint: disable=assignment-from-no-return changed = False # This comparison should work even for tuples and lists, @@ -773,7 +773,7 @@ class Source(Plugin): elif project.ref_storage == ProjectRefStorage.PROJECT_REFS: # First warn if there is a ref already loaded, and reset it - redundant_ref = self.get_ref() + redundant_ref = self.get_ref() # pylint: disable=assignment-from-no-return if redundant_ref is not None: self.set_ref(None, {}) @@ -883,7 +883,7 @@ class Source(Plugin): else: new_ref = self.__do_track() - current_ref = self.get_ref() + current_ref = self.get_ref() # pylint: disable=assignment-from-no-return if new_ref is None: # No tracking, keep current ref @@ -1038,15 +1038,12 @@ class Source(Plugin): if not mirrors or not alias: return self.track(**kwargs) - context = self._get_context() - source_kind = type(self) - # NOTE: We are assuming here that tracking only requires substituting the # first alias used for uri in reversed(project.get_alias_uris(alias, first_pass=self.__first_pass)): new_source = self.__clone_for_uri(uri) try: - ref = new_source.track(**kwargs) + ref = new_source.track(**kwargs) # pylint: disable=assignment-from-none # FIXME: Need to consider temporary vs. permanent failures, # and how this works with retries. except BstError as e: diff --git a/buildstream/utils.py b/buildstream/utils.py index 7f2f9d5fd..0bddb287d 100644 --- a/buildstream/utils.py +++ b/buildstream/utils.py @@ -29,13 +29,13 @@ import re import shutil import signal import stat +from stat import S_ISDIR import string import subprocess import tempfile import itertools import functools from contextlib import contextmanager -from stat import S_ISDIR import psutil @@ -1088,7 +1088,8 @@ def _call(*popenargs, terminate=False, **kwargs): os.killpg(group_id, signal.SIGCONT) with _signals.suspendable(suspend_proc, resume_proc), _signals.terminator(kill_proc): - process = subprocess.Popen(*popenargs, preexec_fn=preexec_fn, **kwargs) + process = subprocess.Popen( # pylint: disable=subprocess-popen-preexec-fn + *popenargs, preexec_fn=preexec_fn, **kwargs) output, _ = process.communicate() exit_code = process.poll() |