diff options
author | Jürg Billeter <j@bitron.ch> | 2019-02-23 16:09:13 +0100 |
---|---|---|
committer | Abderrahim Kitouni <akitouni@gnome.org> | 2020-08-26 12:47:05 +0100 |
commit | d74f20e39a52981a57b2b66c41c8965f74fec979 (patch) | |
tree | bb06edf3c1810f177d732ad8878169b24c24a4f5 | |
parent | f913a061e97ed8ad64382813e02f24aa1942773f (diff) | |
download | buildstream-d74f20e39a52981a57b2b66c41c8965f74fec979.tar.gz |
storage: Remove files parameter from Directory.import_files
-rw-r--r-- | buildstream/storage/_casbaseddirectory.py | 17 | ||||
-rw-r--r-- | buildstream/storage/_filebaseddirectory.py | 6 | ||||
-rw-r--r-- | buildstream/storage/directory.py | 5 |
3 files changed, 10 insertions, 18 deletions
diff --git a/buildstream/storage/_casbaseddirectory.py b/buildstream/storage/_casbaseddirectory.py index b774caf3b..b939fc68a 100644 --- a/buildstream/storage/_casbaseddirectory.py +++ b/buildstream/storage/_casbaseddirectory.py @@ -604,7 +604,7 @@ class CasBasedDirectory(Directory): result.ignored.append(os.path.join(path_prefix, f)) return result - def import_files(self, external_pathspec, *, files=None, + def import_files(self, external_pathspec, *, filter_callback=None, report_written=True, update_mtime=False, can_link=False): @@ -614,10 +614,6 @@ class CasBasedDirectory(Directory): containing a pathname, or a Directory object, to use as the source. - files (list of strings): A list of all the files relative to - the external_pathspec to copy. If 'None' is supplied, all - files are copied. - report_written (bool): Return the full list of files written. Defaults to true. If false, only a list of overwritten files is returned. @@ -627,12 +623,11 @@ class CasBasedDirectory(Directory): can_link (bool): Ignored, since hard links do not have any meaning within CAS. """ - if files is None: - if isinstance(external_pathspec, str): - files = list_relative_paths(external_pathspec) - else: - assert isinstance(external_pathspec, Directory) - files = external_pathspec.list_relative_paths() + if isinstance(external_pathspec, str): + files = list_relative_paths(external_pathspec) + else: + assert isinstance(external_pathspec, Directory) + files = external_pathspec.list_relative_paths() if filter_callback: files = [path for path in files if filter_callback(path)] diff --git a/buildstream/storage/_filebaseddirectory.py b/buildstream/storage/_filebaseddirectory.py index da2f82a58..f29909a5a 100644 --- a/buildstream/storage/_filebaseddirectory.py +++ b/buildstream/storage/_filebaseddirectory.py @@ -74,7 +74,7 @@ class FileBasedDirectory(Directory): return FileBasedDirectory(new_path).descend(subdirectory_spec[1:], create) - def import_files(self, external_pathspec, *, files=None, + def import_files(self, external_pathspec, *, filter_callback=None, report_written=True, update_mtime=False, can_link=False): @@ -86,11 +86,11 @@ class FileBasedDirectory(Directory): source_directory = external_pathspec if can_link and not update_mtime: - import_result = link_files(source_directory, self.external_directory, files=files, + import_result = link_files(source_directory, self.external_directory, filter_callback=filter_callback, ignore_missing=False, report_written=report_written) else: - import_result = copy_files(source_directory, self.external_directory, files=files, + import_result = copy_files(source_directory, self.external_directory, filter_callback=filter_callback, ignore_missing=False, report_written=report_written) if update_mtime: diff --git a/buildstream/storage/directory.py b/buildstream/storage/directory.py index cfc4187ef..7ec4bcf82 100644 --- a/buildstream/storage/directory.py +++ b/buildstream/storage/directory.py @@ -72,7 +72,7 @@ class Directory(): raise NotImplementedError() # Import and export of files and links - def import_files(self, external_pathspec, *, files=None, + def import_files(self, external_pathspec, *, filter_callback=None, report_written=True, update_mtime=False, can_link=False): @@ -81,9 +81,6 @@ class Directory(): Args: external_pathspec: Either a string containing a pathname, or a Directory object, to use as the source. - files (list of str): A list of all the files relative to - the external_pathspec to copy. If 'None' is supplied, all - files are copied. filter_callback (callable): Optional filter callback. Called with the relative path as argument for every file in the source directory. The file is imported only if the callable returns True. |