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

Side by Side Diff: tools/perf/conditionally_execute

Issue 2921353002: Refactor how we fetch Telemetry deps conditionally (Closed)
Patch Set: Only fetch data of official perf benchmarks 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
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=('The gyp condition that acts as the switch. If the '
16 'condition is found in environment variable GYP_DEFINES, '
17 'this will execute the target 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 # A typical GYP_DEFINES string looks s.t like "foo=a bar=1 baz=c". We
25 # tokenize the string before doing string matching.
26 gyp_defines = os.environ.get('GYP_DEFINES', '').split()
27 if options.gyp_condition in gyp_defines:
28 print 'Found matching condition in GYP_DEFINES. Execute: %s' % (
29 ' '.join(script_args))
30 subprocess.check_call(script_args)
31 else:
32 print ('Not found "%s" condition in GYP_DEFINES="%s". '
33 'Skip script execution.' %
34 (options.gyp_condition, gyp_defines))
35 return 0
36
37
38 if __name__ == '__main__':
39 main(sys.argv[1:])
OLDNEW
« no previous file with comments | « DEPS ('k') | tools/perf/fetch_benchmark_deps.py » ('j') | tools/perf/fetch_benchmark_deps.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698