diff options
author | Richard Maw <richard.maw@gmail.com> | 2014-10-29 18:09:15 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@gmail.com> | 2014-10-29 18:22:41 +0000 |
commit | a5a2b03fd2d366ee9955607a3cbf2d1f57a2a1a3 (patch) | |
tree | 4dbbeef6176ee6d3c72c6e02cc3f2e6b384f3f0f /morphlib/fsutils.py | |
parent | f786b2f6f4b4db8c3410c4e8991c36df8d752a27 (diff) | |
download | morph-a5a2b03fd2d366ee9955607a3cbf2d1f57a2a1a3.tar.gz |
Allow invert_paths to skip the top level directory
We're going to be passing it "$CHROOT/" as a writable directory by
default, so it needs to be able to tell that it means to leave
everything writable.
Diffstat (limited to 'morphlib/fsutils.py')
-rw-r--r-- | morphlib/fsutils.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/morphlib/fsutils.py b/morphlib/fsutils.py index 751f73f6..6d651171 100644 --- a/morphlib/fsutils.py +++ b/morphlib/fsutils.py @@ -104,6 +104,11 @@ def invert_paths(tree_walker, paths): for dirpath, dirnames, filenames in tree_walker: + if any(p == dirpath for p in paths): # pragma: no cover + # Dir is an exact match for a path + # don't recurse any further + # Don't yield it, since we don't return listed paths + continue dn_copy = list(dirnames) for subdir in dn_copy: subdirpath = os.path.join(dirpath, subdir) |