aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJukka Jylänki <jujjyl@gmail.com>2014-03-07 13:58:16 +0200
committerJukka Jylänki <jujjyl@gmail.com>2014-03-07 13:58:16 +0200
commit0ad0c0266ba30e3d5dc1a01109feb3e22d55964f (patch)
treeaf18cf566fbd5e0f88911dff06a51dce1f823828
parent8e536ebe3ee36b7fe5319d9a2fa8280fe81d57e7 (diff)
Support syntax --preload-file x@x where both sides are identical and outside the current source tree. The code would accidentally treat that case as if user had instead written '--preload-file x'. Closes #2201.
-rw-r--r--tools/file_packager.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/file_packager.py b/tools/file_packager.py
index cbad25d5..0ab68511 100644
--- a/tools/file_packager.py
+++ b/tools/file_packager.py
@@ -123,12 +123,13 @@ for arg in sys.argv[2:]:
leading = ''
elif leading == 'preload' or leading == 'embed':
mode = leading
- if '@' in arg:
+ uses_at_notation = '@' in arg
+ if uses_at_notation:
srcpath, dstpath = arg.split('@') # User is specifying destination filename explicitly.
else:
srcpath = dstpath = arg # Use source path as destination path.
if os.path.isfile(srcpath) or os.path.isdir(srcpath):
- data_files.append({ 'srcpath': srcpath, 'dstpath': dstpath, 'mode': mode })
+ data_files.append({ 'srcpath': srcpath, 'dstpath': dstpath, 'mode': mode, 'explicit_dst_path': uses_at_notation })
else:
print >> sys.stderr, 'Warning: ' + arg + ' does not exist, ignoring.'
elif leading == 'exclude':
@@ -206,7 +207,7 @@ def add(arg, dirname, names):
new_names.append(name)
if not os.path.isdir(fullname):
dstpath = os.path.join(rootpathdst, os.path.relpath(fullname, rootpathsrc)) # Convert source filename relative to root directory of target FS.
- new_data_files.append({ 'srcpath': fullname, 'dstpath': dstpath, 'mode': mode })
+ new_data_files.append({ 'srcpath': fullname, 'dstpath': dstpath, 'mode': mode, 'explicit_dst_path': True })
del names[:]
names.extend(new_names)
@@ -226,7 +227,7 @@ if len(data_files) == 0:
curr_abspath = os.path.abspath(os.getcwd()) # os.getcwd() always returns the hard path with any symbolic links resolved, even if we cd'd into a symbolic link.
for file_ in data_files:
- if file_['srcpath'] == file_['dstpath']:
+ if not file_['explicit_dst_path']:
# This file was not defined with src@dst, so we inferred the destination from the source. In that case,
# we require that the destination not be under the current location
path = file_['dstpath']