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..603fabc9d6f4a487e81ab3e6921dd68657a8c341 100755 |
| --- a/blimp/tools/create-bundle.py |
| +++ b/blimp/tools/create-bundle.py |
| @@ -15,7 +15,7 @@ import os |
| import subprocess |
| import sys |
| -def ReadDependencies(manifest): |
| +def ReadDependencies(manifest, relpath): |
|
Wez
2016/07/16 00:26:36
Here & below, Python Style Guide is to use unix_ha
Jess
2016/07/16 01:10:32
Updated the variable names you mentioned.
|
| """Read the manifest and return the list of dependencies. |
| :raises IOError: if the manifest could not be read. |
| """ |
| @@ -26,6 +26,8 @@ def ReadDependencies(manifest): |
| dep = line.partition('#')[0].strip() |
| # Ignore empty strings. |
| if dep: |
| + if relpath != '': |
| + dep = os.path.normpath(os.path.join(relpath, dep)) |
| deps.append(dep) |
| return deps |
| @@ -50,9 +52,19 @@ def main(): |
| help=('name and path of bundle to create'), |
| required=True, |
| metavar='FILE') |
| + parser.add_argument('--root-dir', |
| + 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) |
| + deppath = args.build_dir |
| + if args.root_dir: |
| + deppath = args.root_dir |
| + relpath = os.path.relpath(args.build_dir, deppath) |
| + |
| + deps = ReadDependencies(args.manifest, relpath) |
| 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", deppath] + deps |
| for f in args.filelist: |
| dirname, basename = os.path.split(f) |
| subprocess_args.extend(["-C", dirname, basename]) |