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

Side by Side Diff: tools/perf/conditionally_execute

Issue 2921353002: Refactor how we fetch Telemetry deps conditionally (Closed)
Patch Set: Update path ref Created 3 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 unified diff | Download patch
« no previous file with comments | « DEPS ('k') | tools/perf/fetch_benchmark_deps.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2017 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5 import argparse
6 import os
7 import subprocess
8 import sys
9
10
11 def main(args):
12 parser = argparse.ArgumentParser()
13 parser.add_argument(
14 '--gyp-condition', '-c', type=str, required=True,
15 help=('Name of environment variable that acts as the switch. If the '
Kai Ninomiya 2017/06/05 21:58:51 nit: it's not really an environment variable that
nednguyen 2017/06/05 22:24:24 Done.
16 'variable is set in the environment, this will execute the target '
17 'script'))
18 options, script_args = parser.parse_known_args()
19
20 # Make sure that we always execute target script with python.
21 if 'python' not in script_args[0]:
22 script_args.insert(0, sys.executable)
23
24 gyp_defines = os.environ.get('GYP_DEFINES', '')
25 if options.gyp_condition in gyp_defines:
Kai Ninomiya 2017/06/05 21:58:51 This may not matter since this should get replaced
nednguyen 2017/06/05 22:24:24 Done.
26 print 'Found matching condition in GYP_DEFINES. Execute: %s' % (
27 ' '.join(script_args))
28 subprocess.check_call(script_args)
29 else:
30 print ('Not found "%s" condition in GYP_DEFINES="%s". '
31 'Skip script execution.' %
32 (options.gyp_condition, gyp_defines))
33 return 0
34
35
36 if __name__ == '__main__':
37 main(sys.argv[1:])
OLDNEW
« no previous file with comments | « DEPS ('k') | tools/perf/fetch_benchmark_deps.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698