diff options
author | Ankit Jain <radical@gmail.com> | 2019-01-28 23:55:49 +0300 |
---|---|---|
committer | Ankit Jain <radical@gmail.com> | 2019-02-20 17:30:54 +0300 |
commit | 5d818c1af4d10c9325a40aa66dc0c994aa3e1781 (patch) | |
tree | 31a80eee21919c7e3a57f55878cbf22ef867e377 | |
parent | 45d61774e84f3f99c6e49d078396096d8e52c48e (diff) |
iterate_dir: Include symlinks to dirs also
Given:
`for root, subdirs, filelist in os.walk(dir):`
.. symlinks to directories are only returned in `subdirs`. So, they need
to handled explicitly.
This meant that when bockbuild tried to zip up the contents of mono and
msbuild to move to the staging directory, then such symlinks were not
picked up thus breaking the build.
-rw-r--r-- | bockbuild/util/util.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/bockbuild/util/util.py b/bockbuild/util/util.py index 96233cc..115a069 100644 --- a/bockbuild/util/util.py +++ b/bockbuild/util/util.py @@ -548,6 +548,12 @@ def iterate_dir(dir, with_links=False, with_dirs=False, summary=False): dirs = dirs + 1 if with_dirs: yield root + if with_dirs and with_links: + for subdir in subdirs: + path = os.path.join(root, subdir) + if os.path.islink(path): + links = links + 1 + yield path for file in filelist: path = os.path.join(root, file) if os.path.islink(path): |