| OLD | NEW | 
|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python | 
| 2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 The Chromium Authors. All rights reserved. | 
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be | 
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. | 
| 5 | 5 | 
| 6 """This script rebuilds Python & Go universes of infra.git multiverse and | 6 """This script rebuilds Python & Go universes of infra.git multiverse and | 
| 7 invokes CIPD client to package and upload chunks of it to the CIPD repository as | 7 invokes CIPD client to package and upload chunks of it to the CIPD repository as | 
| 8 individual packages. | 8 individual packages. | 
| 9 | 9 | 
| 10 See build/packages/*.yaml for definition of packages. | 10 See build/packages/*.yaml for definition of packages. | 
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 171   """Returns content of YAML file as python dict.""" | 171   """Returns content of YAML file as python dict.""" | 
| 172   # YAML lib is in venv, not activated here. Go through hoops. | 172   # YAML lib is in venv, not activated here. Go through hoops. | 
| 173   oneliner = ( | 173   oneliner = ( | 
| 174       'import json, sys, yaml; ' | 174       'import json, sys, yaml; ' | 
| 175       'json.dump(yaml.safe_load(sys.stdin), sys.stdout)') | 175       'json.dump(yaml.safe_load(sys.stdin), sys.stdout)') | 
| 176   if sys.platform == 'win32': | 176   if sys.platform == 'win32': | 
| 177     python_venv_path = ('Scripts', 'python.exe') | 177     python_venv_path = ('Scripts', 'python.exe') | 
| 178   else: | 178   else: | 
| 179     python_venv_path = ('bin', 'python') | 179     python_venv_path = ('bin', 'python') | 
| 180   executable = os.path.join(py_venv, *python_venv_path) | 180   executable = os.path.join(py_venv, *python_venv_path) | 
|  | 181   env = os.environ.copy() | 
|  | 182   env.pop('PYTHONPATH', None) | 
| 181   proc = subprocess.Popen( | 183   proc = subprocess.Popen( | 
| 182       [executable, '-c', oneliner], | 184       [executable, '-c', oneliner], | 
| 183       executable=executable, | 185       executable=executable, | 
| 184       stdin=subprocess.PIPE, | 186       stdin=subprocess.PIPE, | 
| 185       stdout=subprocess.PIPE) | 187       stdout=subprocess.PIPE, | 
|  | 188       env=env) | 
| 186   with open(path, 'r') as f: | 189   with open(path, 'r') as f: | 
| 187     out, _ = proc.communicate(f.read()) | 190     out, _ = proc.communicate(f.read()) | 
| 188   if proc.returncode: | 191   if proc.returncode: | 
| 189     raise BuildException('Failed to parse YAML at %s' % path) | 192     raise BuildException('Failed to parse YAML at %s' % path) | 
| 190   return json.loads(out) | 193   return json.loads(out) | 
| 191 | 194 | 
| 192 | 195 | 
| 193 def should_process_on_builder(pkg_def_file, py_venv, builder): | 196 def should_process_on_builder(pkg_def_file, py_venv, builder): | 
| 194   """Returns True if package should be processed by current CI builder.""" | 197   """Returns True if package should be processed by current CI builder.""" | 
| 195   if not builder: | 198   if not builder: | 
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 507       args.build, | 510       args.build, | 
| 508       args.upload, | 511       args.upload, | 
| 509       args.service_url, | 512       args.service_url, | 
| 510       args.tags or [], | 513       args.tags or [], | 
| 511       args.service_account_json, | 514       args.service_account_json, | 
| 512       args.json_output) | 515       args.json_output) | 
| 513 | 516 | 
| 514 | 517 | 
| 515 if __name__ == '__main__': | 518 if __name__ == '__main__': | 
| 516   sys.exit(main(sys.argv[1:])) | 519   sys.exit(main(sys.argv[1:])) | 
| OLD | NEW | 
|---|