Chromium Code Reviews| Index: blimp/tools/create-bundle.py |
| diff --git a/blimp/tools/create-bundle.py b/blimp/tools/create-bundle.py |
| index 5aab7fcb17938874eb42d0c8559aa68fbe074854..5d9bd9a6ef9d7b53b8d7bb8e57aea8699c60118f 100755 |
| --- a/blimp/tools/create-bundle.py |
| +++ b/blimp/tools/create-bundle.py |
| @@ -15,19 +15,21 @@ import os |
| import subprocess |
| import sys |
| -def ReadDependencies(manifest): |
| +def ReadDependencies(manifest, relative_path): |
| """Read the manifest and return the list of dependencies. |
|
maniscalco
2016/07/18 16:01:05
Docs of this function need to be updated now that
Jess
2016/07/19 21:36:08
Done.
|
| :raises IOError: if the manifest could not be read. |
| """ |
| - deps = [] |
| + dependency_list = [] |
| with open(manifest) as f: |
| for line in f.readlines(): |
| # Strip comments. |
| - dep = line.partition('#')[0].strip() |
| + dependency = line.partition('#')[0].strip() |
| # Ignore empty strings. |
| - if dep: |
| - deps.append(dep) |
| - return deps |
| + if dependency: |
| + if relative_path != '': |
| + dependency = os.path.normpath(os.path.join(relative_path, dependency)) |
| + dependency_list.append(dependency) |
| + return dependency_list |
| def main(): |
| parser = argparse.ArgumentParser(description=__doc__) |
| @@ -50,9 +52,19 @@ def main(): |
| help=('name and path of bundle to create'), |
| required=True, |
| metavar='FILE') |
| + parser.add_argument('--root-dir', |
|
maniscalco
2016/07/18 16:01:05
Let's say the manifest (really the runtime deps fi
Jess
2016/07/19 21:36:08
Updated. PTAL. Agree this value's meaning is not t
|
| + help=('optional docker rootdir to use to reference ' |
| + 'dependencies; defaults to build-dir'), |
| + required=False, |
| + metavar='DIR') |
| args = parser.parse_args() |
| - deps = ReadDependencies(args.manifest) |
| + dependencies_path = args.build_dir |
| + if args.root_dir: |
| + dependencies_path = args.root_dir |
| + relative_path = os.path.relpath(args.build_dir, dependencies_path) |
| + |
| + dependency_list = ReadDependencies(args.manifest, relative_path) |
| try: |
| env = os.environ.copy() |
| @@ -65,7 +77,7 @@ def main(): |
| # use as part of a "docker build". That is group readable with |
| # executable files also being group executable. |
| "--mode=g+rX", |
| - "-C", args.build_dir] + deps |
| + "-C", dependencies_path] + dependency_list |
| for f in args.filelist: |
| dirname, basename = os.path.split(f) |
| subprocess_args.extend(["-C", dirname, basename]) |