diff options
author | Jürg Billeter <j@bitron.ch> | 2019-02-23 16:09:13 +0100 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2019-02-26 13:06:53 +0100 |
commit | a2831751f1a269466ff896f8d229ec10d9178de9 (patch) | |
tree | fa4725db026d2137c6b729f8dfd3f81ac1ee913f /buildstream | |
parent | 9f6a3332812f4caa036084f843cf95b9c6b9181f (diff) | |
download | buildstream-a2831751f1a269466ff896f8d229ec10d9178de9.tar.gz |
storage: Remove files parameter from Directory.import_files
Diffstat (limited to 'buildstream')
-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 68b0ded6d..537feade2 100644 --- a/buildstream/storage/_casbaseddirectory.py +++ b/buildstream/storage/_casbaseddirectory.py @@ -410,7 +410,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): @@ -420,10 +420,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. @@ -433,12 +429,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 5e0b9e2ac..dfb310ae1 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 f19a8bed6..70054f78c 100644 --- a/buildstream/storage/directory.py +++ b/buildstream/storage/directory.py @@ -73,7 +73,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): @@ -82,9 +82,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. |