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

Unified Diff: recipes.py

Issue 2061263003: add basic bootstrap for coverage (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/recipes-py@master
Patch Set: Fix recipes readme. Created 4 years, 6 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 | « bootstrap/virtualenv/virtualenv_support/setuptools-8.2.1-py2.py3-none-any.whl ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: recipes.py
diff --git a/recipes.py b/recipes.py
index 2d59293e4f203d2ac00bbe25b9fcf792c8dddea3..6061617d6074ccf1b848d52c903c763560403c31 100755
--- a/recipes.py
+++ b/recipes.py
@@ -222,6 +222,8 @@ def main():
# Super-annoyingly, we need to manually parse for simulation_test since
# argparse is bonkers and doesn't allow us to forward --help to subcommands.
+ # Save old_args for if we're using bootstrap
+ original_sys_argv = sys.argv[:]
if 'simulation_test' in sys.argv:
index = sys.argv.index('simulation_test')
sys.argv = sys.argv[:index+1] + [json.dumps(sys.argv[index+1:])]
@@ -249,6 +251,10 @@ def main():
parser.add_argument('-O', '--project-override', metavar='ID=PATH',
action=ProjectOverrideAction,
help='Override a project repository path with a local one.')
+ parser.add_argument(
+ '--use-bootstrap', action='store_true',
+ help='Use bootstrap/bootstrap.py to create a isolated python virtualenv'
+ ' with required python dependencies.')
subp = parser.add_subparsers()
@@ -376,6 +382,18 @@ def main():
args = parser.parse_args()
+ if args.use_bootstrap and not os.environ.pop('RECIPES_RUN_BOOTSTRAP', None):
+ subprocess.check_call(
+ [sys.executable, 'bootstrap/bootstrap.py', '--deps-file',
+ 'bootstrap/deps.pyl', 'ENV'],
+ cwd=os.path.dirname(os.path.realpath(__file__)))
+
+ os.environ['RECIPES_RUN_BOOTSTRAP'] = '1'
+ args = sys.argv
+ return subprocess.call(
+ ['ENV/bin/python'] + original_sys_argv,
+ cwd=os.path.dirname(os.path.realpath(__file__)))
+
if args.verbose:
logging.getLogger().setLevel(logging.INFO)
« no previous file with comments | « bootstrap/virtualenv/virtualenv_support/setuptools-8.2.1-py2.py3-none-any.whl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698