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..ea2303e233de87bfc8d907efc6bc15ee3e7b5c06 100755 |
| --- a/blimp/tools/create-bundle.py |
| +++ b/blimp/tools/create-bundle.py |
| @@ -15,19 +15,22 @@ import os |
| import subprocess |
| import sys |
| -def ReadDependencies(manifest): |
| - """Read the manifest and return the list of dependencies. |
| +def ReadDependencies(manifest, relative_path): |
| + """Read the manifest. Takes each dependency found within, prepends it with |
|
Wez
2016/07/22 00:50:28
nit: Shouldn't the description start with "Returns
Jess
2016/07/22 01:01:51
Good points. I didn't update the comments with the
|
| + relative path (optional), normalizes the resulting combined path, and adds |
| + it to the returned dependency list. |
| :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: |
| + 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 +53,19 @@ def main(): |
| help=('name and path of bundle to create'), |
| required=True, |
| metavar='FILE') |
| + parser.add_argument('--tar-contents-rooted-in', |
| + help=('optional path prefix to use inside the resulting ' |
| + 'tar file'), |
| + required=False, |
| + metavar='DIR') |
| args = parser.parse_args() |
| - deps = ReadDependencies(args.manifest) |
| + dependencies_path = args.build_dir |
| + if args.tar_contents_rooted_in: |
| + dependencies_path = args.tar_contents_rooted_in |
| + relative_path = os.path.relpath(args.build_dir, dependencies_path) |
| + |
| + dependency_list = ReadDependencies(args.manifest, relative_path) |
| try: |
| env = os.environ.copy() |
| @@ -65,7 +78,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 |
|
Sriram
2016/07/22 00:38:51
I am a little confused... Is the final structure o
Jess
2016/07/22 01:01:51
Here is what is currently generated with a build d
|
| + "-C", dependencies_path] + dependency_list |
| for f in args.filelist: |
| dirname, basename = os.path.split(f) |
| subprocess_args.extend(["-C", dirname, basename]) |