diff options
author | Jürg Billeter <j@bitron.ch> | 2019-02-01 09:57:59 +0000 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2019-02-11 05:12:25 +0000 |
commit | 89973fb3721a6b02ba1b1b7be46e34fbce137472 (patch) | |
tree | bfe0ac7c16ff84f28e682495edf70a63fd54a18b | |
parent | f95e222e49e7dd6f05634e209a03856960332374 (diff) | |
download | buildstream-89973fb3721a6b02ba1b1b7be46e34fbce137472.tar.gz |
utils.py: Remove list_dirs parameter from list_relative_paths()
list_dirs was always True in the BuildStream code base. There was also a
bug in the list_dirs=False code path as it did not return symlinks in
`dirnames`.
This is an API break, however, there are no known external callers.
-rw-r--r-- | buildstream/plugins/sources/local.py | 2 | ||||
-rw-r--r-- | buildstream/utils.py | 14 |
2 files changed, 7 insertions, 9 deletions
diff --git a/buildstream/plugins/sources/local.py b/buildstream/plugins/sources/local.py index ea2f6e013..d4965cc9e 100644 --- a/buildstream/plugins/sources/local.py +++ b/buildstream/plugins/sources/local.py @@ -97,7 +97,7 @@ class LocalSource(Source): with self.timed_activity("Staging local files at {}".format(self.path)): if os.path.isdir(self.fullpath): - files = list(utils.list_relative_paths(self.fullpath, list_dirs=True)) + files = list(utils.list_relative_paths(self.fullpath)) utils.copy_files(self.fullpath, directory, files=files) else: destfile = os.path.join(directory, os.path.basename(self.path)) diff --git a/buildstream/utils.py b/buildstream/utils.py index c8d79c95a..224ac6ee8 100644 --- a/buildstream/utils.py +++ b/buildstream/utils.py @@ -111,7 +111,7 @@ class FileListResult(): return ret -def list_relative_paths(directory, *, list_dirs=True): +def list_relative_paths(directory): """A generator for walking directory relative paths This generator is useful for checking the full manifest of @@ -125,7 +125,6 @@ def list_relative_paths(directory, *, list_dirs=True): Args: directory (str): The directory to list files in - list_dirs (bool): Whether to list directories Yields: Relative filenames in `directory` @@ -152,16 +151,15 @@ def list_relative_paths(directory, *, list_dirs=True): # subdirectories in the walked `dirpath`, so we extract # these symlinks from `dirnames` # - if list_dirs: - for d in dirnames: - fullpath = os.path.join(dirpath, d) - if os.path.islink(fullpath): - yield os.path.join(basepath, d) + for d in dirnames: + fullpath = os.path.join(dirpath, d) + if os.path.islink(fullpath): + yield os.path.join(basepath, d) # We've decended into an empty directory, in this case we # want to include the directory itself, but not in any other # case. - if list_dirs and not filenames: + if not filenames: yield relpath # List the filenames in the walked directory |