Chromium Code Reviews| Index: recipes.py |
| diff --git a/recipes.py b/recipes.py |
| index 5f6a2091752e774da566aa7db97a8df0e558ab6b..4d2a548d2313f46d380de8216794140c2f50895b 100755 |
| --- a/recipes.py |
| +++ b/recipes.py |
| @@ -218,6 +218,36 @@ def info(args): |
| print package_spec.recipes_path |
| +def isolate(package_deps, args): |
| + from recipe_engine import package |
| + |
| + repo_root, config_file = get_package_config(args) |
| + context = package.PackageContext.from_proto_file(repo_root, config_file) |
| + base_path = package_deps.root_package.recipes_dir |
| + def norm(p): |
| + return os.path.relpath(p, base_path) |
| + recipes_tool = norm(os.path.join( |
| + package_deps.get_package('recipe_engine').recipes_dir, |
| + 'recipes.py')) |
| + |
| + overrides = [ '-O %s=%s' % (k, norm(v)) |
|
M-A Ruel
2016/01/16 00:42:39
formatting is inconsistent
luqui
2016/01/16 03:55:29
Fixed... I think?
|
| + for k,v in args.project_override.iteritems() ] |
|
M-A Ruel
2016/01/16 00:42:39
sorted()
so the output is deterministic
luqui
2016/01/16 03:55:29
Done.
|
| + |
| + print json.dumps({ |
| + 'variables': { |
| + 'files': sorted(norm(f) |
| + for f in package_deps.root_package.all_files(context)), |
| + 'command': [ |
| + 'python', |
| + recipes_tool, |
| + '--package', |
| + norm(package_deps.root_package.repo_spec.proto_file(context).path), |
| + '--no-fetch', |
| + ] + overrides, |
| + }, |
| + }, indent=2, separators=(',', ': ')) |
|
M-A Ruel
2016/01/16 00:42:39
sort_keys=True,
luqui
2016/01/16 03:55:29
Done.
|
| + |
| + |
| def main(): |
| from recipe_engine import package |
| @@ -244,6 +274,7 @@ def main(): |
| help='Path to the script used to bootstrap this tool (internal use only)') |
| parser.add_argument('-O', '--project-override', metavar='ID=PATH', |
| action=ProjectOverrideAction, |
| + default={}, |
| help='Override a project repository path with a local one.') |
| subp = parser.add_subparsers() |
| @@ -315,6 +346,12 @@ def main(): |
| '--recipes-dir', action='store_true', |
| help='Get the subpath where the recipes live relative to repository root') |
| + isolate_p = subp.add_parser( |
| + 'isolate', |
| + help='Write an isolate file to stdout for the recipe toolchain of the ' |
| + 'current project') |
| + isolate_p.set_defaults(command='isolate') |
| + |
| args = parser.parse_args() |
| if args.verbose: |
| @@ -343,6 +380,8 @@ def main(): |
| return doc(package_deps, args) |
| elif args.command == 'info': |
| return info(args) |
| + elif args.command == 'isolate': |
| + return isolate(package_deps, args) |
| else: |
| print """Dear sir or madam, |
| It has come to my attention that a quite impossible condition has come |