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

Side by Side Diff: third_party/typ/run

Issue 664123005: Roll typ to v0.8.6 / re25b780b0b147580ef248c212b238446264d9d78 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 | « third_party/typ/README.chromium ('k') | third_party/typ/typ/__main__.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 from __future__ import print_function 3 from __future__ import print_function
4 4
5 import argparse 5 import argparse
6 import os 6 import os
7 import subprocess 7 import subprocess
8 import sys 8 import sys
9 9
10 from tools import cov 10 from tools import cov
11 11
12 12
13 is_python3 = bool(sys.version_info.major == 3) 13 is_python3 = bool(sys.version_info.major == 3)
14 has_python34 = False 14 has_python34 = False
15 verbose = False 15 verbose = False
16 repo_dir = os.path.abspath(os.path.dirname(__file__))
17 path_to_cov = os.path.join(repo_dir, 'tools', 'cov.py')
18 path_to_runner = os.path.join(repo_dir, 'typ', 'runner.py')
16 19
17 20
18 def call(*args, **kwargs): 21 def call(*args, **kwargs):
19 if verbose: 22 if verbose:
20 print(' '.join(args[0])) 23 print(' '.join(args[0]))
21 ret = subprocess.call(*args, **kwargs) 24 ret = subprocess.call(*args, **kwargs)
22 if ret != 0: 25 if ret != 0:
23 sys.exit(ret) 26 sys.exit(ret)
24 27
25 28
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 93
91 def run_build(args): 94 def run_build(args):
92 call([sys.executable, 'setup.py', 'build', '--quiet']) 95 call([sys.executable, 'setup.py', 'build', '--quiet'])
93 96
94 97
95 def run_clean(args): 98 def run_clean(args):
96 call(['git', 'clean', '-fxd']) 99 call(['git', 'clean', '-fxd'])
97 100
98 101
99 def run_coverage(args): 102 def run_coverage(args):
100 repo_dir = os.path.abspath(os.path.dirname(__file__))
101 path_to_cov = os.path.join(repo_dir, 'tools', 'cov.py')
102 if not args.path: 103 if not args.path:
103 args.path = [repo_dir] 104 args.path = [repo_dir]
104 if not args.source: 105 if not args.source:
105 args.source = [os.path.join(repo_dir, 'typ')] 106 args.source = [os.path.join(repo_dir, 'typ')]
106 argv = cov.argv_from_args(args) 107 argv = cov.argv_from_args(args)
107 cov_args = ['-m', 'typ', '-j', '1'] 108 cov_args = [path_to_runner, '-j', '1']
108 call(['python', path_to_cov] + argv + cov_args) 109 call(['python', path_to_cov] + argv + cov_args)
109 if has_python34: 110 if has_python34:
110 call(['python3', path_to_cov] + argv + cov_args) 111 call(['python3', path_to_cov] + argv + cov_args)
111 112
112 113
113 def run_develop(args): 114 def run_develop(args):
114 call([sys.executable, 'setup.py', 'develop']) 115 call([sys.executable, 'setup.py', 'develop'])
115 116
116 117
117 def run_format(args): 118 def run_format(args):
(...skipping 13 matching lines...) Expand all
131 argv = ['--user'] 132 argv = ['--user']
132 call([sys.executable, 'setup.py', 'install'] + argv) 133 call([sys.executable, 'setup.py', 'install'] + argv)
133 134
134 135
135 def run_lint(args): 136 def run_lint(args):
136 call('pylint --rcfile=pylintrc */*.py */*/*.py', shell=True) 137 call('pylint --rcfile=pylintrc */*.py */*/*.py', shell=True)
137 call('pep8 *.py */*.py */*/*.py', shell=True) 138 call('pep8 *.py */*.py */*/*.py', shell=True)
138 139
139 140
140 def run_tests(args): 141 def run_tests(args):
141 # Tests that we can run the command line directly if typ is in sys.path. 142 # Test that we can run the module directly if typ is in sys.path.
142 call(['python', os.path.join('typ', 'runner.py'), 143 call(['python', '-m', 'typ', 'typ.tests.main_test.TestMain.test_basic'])
143 'typ.tests.main_test.TestMain.test_basic'])
144 144
145 # Test that we can run the command line directly if typ is not in sys.path. 145 # Test that we can run the command line directly if typ is not in sys.path.
146 repo_dir = os.path.abspath(os.path.dirname(__file__))
147 home_dir = os.environ['HOME'] 146 home_dir = os.environ['HOME']
148 call(['python', os.path.join(repo_dir, 'typ', 'runner.py'), 147 call(['python', path_to_runner, 'typ.tests.main_test.TestMain.test_basic'],
149 'typ.tests.main_test.TestMain.test_basic'], cwd=home_dir) 148 cwd=home_dir)
150 149
151 # Now run all the tests under Python2 and Python3. 150 # Now run all the tests under Python2 and Python3.
152 call(['python', '-m', 'typ']) 151 call(['python', path_to_runner])
153 if has_python34: 152 if has_python34:
154 call(['python3', '-m', 'typ']) 153 call(['python3', path_to_runner])
155 154
156 155
157 if __name__ == '__main__': 156 if __name__ == '__main__':
158 sys.exit(main(sys.argv[1:])) 157 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « third_party/typ/README.chromium ('k') | third_party/typ/typ/__main__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698