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

Unified Diff: testing/scripts/checkdeps.py

Issue 649683005: Add src-side launcher for telemetry_unittests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: get_compile_targets.py Created 6 years, 2 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 | testing/scripts/common.py » ('j') | testing/scripts/common.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/scripts/checkdeps.py
diff --git a/testing/scripts/checkdeps.py b/testing/scripts/checkdeps.py
index 83abfdf53b063080799b5f6989902ee00291a1f8..db2bc00f8fe5e9fd544bb93cb7036b1ded54719d 100755
--- a/testing/scripts/checkdeps.py
+++ b/testing/scripts/checkdeps.py
@@ -3,41 +3,18 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-import argparse
-import contextlib
import json
import os
-import subprocess
import sys
-import tempfile
-SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__))
-SRC_DIR = os.path.abspath(
- os.path.join(SCRIPT_DIR, os.path.pardir, os.path.pardir))
-
-
-def run_command(argv):
- print 'Running %r' % argv
- rc = subprocess.call(argv)
- print 'Command %r returned exit code %d' % (argv, rc)
- return rc
-
-
-@contextlib.contextmanager
-def temporary_file():
- fd, path = tempfile.mkstemp()
- os.close(fd)
- try:
- yield path
- finally:
- os.remove(path)
+import common
def mode_run(args):
- with temporary_file() as tempfile_path:
- rc = run_command([
- os.path.join(SRC_DIR, 'buildtools', 'checkdeps', 'checkdeps.py'),
+ with common.temporary_file() as tempfile_path:
+ rc = common.run_command([
+ os.path.join(common.SRC_DIR, 'buildtools', 'checkdeps', 'checkdeps.py'),
'--json', tempfile_path
])
@@ -58,18 +35,10 @@ def mode_run(args):
return rc
-def main(argv):
- parser = argparse.ArgumentParser()
-
- subparsers = parser.add_subparsers()
-
- run_parser = subparsers.add_parser('run')
- run_parser.add_argument('--output', required=True)
- run_parser.set_defaults(func=mode_run)
-
- args = parser.parse_args(argv)
- return args.func(args)
+def mode_compile_targets(args):
iannucci 2014/10/22 07:23:14 I would drop the mode_ prefix from these. maybe 'm
Paweł Hajdan Jr. 2014/10/22 09:43:27 Done.
+ with open(args.output, 'w') as f:
+ json.dump([], f)
if __name__ == '__main__':
- sys.exit(main(sys.argv[1:]))
+ sys.exit(common.run_script(sys.argv[1:], mode_run, mode_compile_targets))
iannucci 2014/10/22 07:23:14 what about passing { 'run': mode_run, 'compile
Paweł Hajdan Jr. 2014/10/22 09:43:27 Done.
« no previous file with comments | « no previous file | testing/scripts/common.py » ('j') | testing/scripts/common.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698