summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMirko Vogt <mirko.vogt@sensorberg.com>2019-11-04 23:16:37 +0000
committerDamien George <damien.p.george@gmail.com>2019-11-06 11:41:06 +1100
commit2f71d66ef7f6bfa93bdc51ab0eaf32cd03a81189 (patch)
tree9a9fa7d3fcbc734c98d35744635af543c07acb9f
parent4f0f3dfb410062db4d41e42c2c7cff6c8b48f071 (diff)
tools/makemanifest.py: Follow symlinks when freezing linked directories.
While the new manifest.py style got introduced for freezing python code into the resulting binary, the old way - where files and modules within ports/*/modules where baked into the resulting binary - was still supported via `freeze('$(PORT_DIR)/modules')` within manifest.py. However behaviour changed for symlinked directories (=modules), as those links weren't followed anymore. This commit restores the original behaviour by explicitly following symlinks within a modules/ directory
-rw-r--r--tools/makemanifest.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/makemanifest.py b/tools/makemanifest.py
index 9889d5075..a3aa42ca4 100644
--- a/tools/makemanifest.py
+++ b/tools/makemanifest.py
@@ -147,7 +147,7 @@ def get_timestamp(path, default=None):
def get_timestamp_newest(path):
ts_newest = 0
- for dirpath, dirnames, filenames in os.walk(path):
+ for dirpath, dirnames, filenames in os.walk(path, followlinks=True):
for f in filenames:
ts_newest = max(ts_newest, get_timestamp(os.path.join(dirpath, f)))
return ts_newest
@@ -171,7 +171,7 @@ def freeze_internal(kind, path, script, opt):
raise FreezeError('can only freeze one str directory')
manifest_list.append((KIND_AS_STR, path, script, opt))
elif script is None:
- for dirpath, dirnames, filenames in os.walk(path):
+ for dirpath, dirnames, filenames in os.walk(path, followlinks=True):
for f in filenames:
freeze_internal(kind, path, (dirpath + '/' + f)[len(path) + 1:], opt)
elif not isinstance(script, str):