diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2018-02-26 17:32:46 +0000 |
---|---|---|
committer | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2018-04-23 13:37:06 +0000 |
commit | 4759e2adc20be4847894e484dd9ca8b3ac490ca1 (patch) | |
tree | 258656b94783ce65536b83c4aa93cde82ea8feda /buildstream | |
parent | 75ebcf56dc03e4cb53ce7739dd3d621fd1d0f2c9 (diff) | |
download | buildstream-4759e2adc20be4847894e484dd9ca8b3ac490ca1.tar.gz |
plugins/elements/compose.py: Use sets instead of lists where appropriate
There is no significant order for the lists of added, removed and
modified files, so use an unordered set() to store the data.
Diffstat (limited to 'buildstream')
-rw-r--r-- | buildstream/plugins/elements/compose.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/buildstream/plugins/elements/compose.py b/buildstream/plugins/elements/compose.py index 370f19dcf..e03ab6f49 100644 --- a/buildstream/plugins/elements/compose.py +++ b/buildstream/plugins/elements/compose.py @@ -110,9 +110,9 @@ class ComposeElement(Element): f: getmtime(os.path.join(basedir, f)) for f in utils.list_relative_paths(basedir) } - modified_files = [] - removed_files = [] - added_files = [] + modified_files = set() + removed_files = set() + added_files = set() # Run any integration commands provided by the dependencies # once they are all staged and ready @@ -128,15 +128,16 @@ class ComposeElement(Element): for path in utils.list_relative_paths(basedir): seen.add(path) if snapshot.get(path) is None: - added_files.append(path) + added_files.add(path) elif snapshot[path] != getmtime(os.path.join(basedir, path)): - modified_files.append(path) + modified_files.add(path) # Calculate removed files - removed_files = [ + removed_files = set([ path for path in manifest if path not in seen - ] + ]) + self.info("Integration modified {}, added {} and removed {} files" .format(len(modified_files), len(added_files), len(removed_files))) |