Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(673)

Unified Diff: recipes.py

Issue 1570333002: 'recipes.py isolate' command to build an isolate of the current package's toolchain (Closed) Base URL: git@github.com:luci/recipes-py.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: recipes.py
diff --git a/recipes.py b/recipes.py
index 5f6a2091752e774da566aa7db97a8df0e558ab6b..303177306b2a4594dcbbde92e270de041d895ace 100755
--- a/recipes.py
+++ b/recipes.py
@@ -218,6 +218,30 @@ 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):
M-A Ruel 2016/01/09 00:51:59 I would have written it as: norm = lambda *p: os.p
+ return os.path.relpath(p, base_path)
+ recipes_tool = norm(os.path.join(
+ package_deps.get_package('recipe_engine').recipes_dir,
+ 'recipes.py'))
+ print json.dumps({
+ 'variables': {
+ 'files': [norm(f) for f in package_deps.root_package.all_files(context)],
M-A Ruel 2016/01/09 00:51:59 sorted()
luqui 2016/01/15 23:11:27 Done.
+ 'command': [
+ 'python',
+ recipes_tool,
+ '--package', norm(
M-A Ruel 2016/01/09 00:51:59 put the norm()'ed item in a separate line.
luqui 2016/01/15 23:11:27 Done.
+ package_deps.root_package.repo_spec.proto_file(context).path),
+ '--no-fetch',
+ ],
+ },
+ }, indent=2, separators=(',', ': '))
M-A Ruel 2016/01/09 00:51:59 return 0 2 empty lines
luqui 2016/01/15 23:11:27 Done.
+
def main():
from recipe_engine import package
@@ -315,6 +339,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 +373,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

Powered by Google App Engine
This is Rietveld 408576698