Skip to content

Commit

Permalink
tools/makemanifest.py: Follow symlinks when freezing linked directories.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Mirko Vogt authored and dpgeorge committed Nov 6, 2019
1 parent 4f0f3df commit 2f71d66
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/makemanifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand Down

0 comments on commit 2f71d66

Please sign in to comment.