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

Unified Diff: recipe_engine/bundle.py

Issue 2845783002: [recipes.py] Move fetch, lint and bundle parsers to separate modules. (Closed)
Patch Set: rebase Created 3 years, 8 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
« no previous file with comments | « no previous file | recipe_engine/fetch.py » ('j') | recipes.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: recipe_engine/bundle.py
diff --git a/recipe_engine/bundle.py b/recipe_engine/bundle.py
index a574a69be83607001003b5fd79d4139026fba652..21ab4a965294d4b93baf787f3c708ac3d176a260 100755
--- a/recipe_engine/bundle.py
+++ b/recipe_engine/bundle.py
@@ -625,7 +625,22 @@ def prep_recipes_py(universe, root_package, destination):
recipes_bat.write(u' %*\n')
-def main(root_package, universe, destination):
+def add_subparser(parser):
+ bundle_p = parser.add_parser(
+ 'bundle',
+ description=(
+ 'Create a hermetically runnable recipe bundle. This captures the result'
+ ' of all network operations the recipe_engine might normally do to'
+ ' bootstrap itself.'))
+ bundle_p.add_argument(
+ '--destination', default='./bundle',
+ type=os.path.abspath,
+ help='The directory of where to put the bundle (default: %(default)r).')
+
+ bundle_p.set_defaults(command='bundle', func=main)
+
+
+def main(package_deps, args):
"""
Args:
root_package (package.Package) - The recipes script in the produced bundle
dnj 2017/04/27 16:33:53 nit: update args
@@ -635,12 +650,12 @@ def main(root_package, universe, destination):
destination (str) - Path to the bundle output folder. This folder should not
exist before calling this function.
"""
- check(root_package, package.Package)
- check(universe, loader.RecipeUniverse)
- check(destination, str)
+ universe = loader.RecipeUniverse(package_deps, args.package)
+ destination = args.destination
+ root_package = package_deps.root_package
logging.basicConfig()
- destination = prepare_destination(destination)
+ destination = prepare_destination(args.destination)
for pkg in universe.packages:
export_package(pkg, destination, pkg == root_package)
prep_recipes_py(universe, root_package, destination)
« no previous file with comments | « no previous file | recipe_engine/fetch.py » ('j') | recipes.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698