| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 import argparse | 6 import argparse |
| 7 import contextlib | 7 import contextlib |
| 8 import glob | 8 import glob |
| 9 import logging | 9 import logging |
| 10 import os | 10 import os |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 pip = os.path.join(sys.prefix, bin_dir, 'pip') | 144 pip = os.path.join(sys.prefix, bin_dir, 'pip') |
| 145 | 145 |
| 146 links = get_links(deps) | 146 links = get_links(deps) |
| 147 with html_index(links) as ipath: | 147 with html_index(links) as ipath: |
| 148 requirements = [] | 148 requirements = [] |
| 149 # TODO(iannucci): Do this as a requirements.txt | 149 # TODO(iannucci): Do this as a requirements.txt |
| 150 for name, deps_entry in deps.iteritems(): | 150 for name, deps_entry in deps.iteritems(): |
| 151 if not deps_entry.get('implicit'): | 151 if not deps_entry.get('implicit'): |
| 152 requirements.append('%s==%s' % (name, deps_entry['version'])) | 152 requirements.append('%s==%s' % (name, deps_entry['version'])) |
| 153 subprocess.check_call( | 153 subprocess.check_call( |
| 154 [pip, 'install', '--no-index', '--download-cache', | 154 [pip, 'install', '--no-index', '-f', ipath] + requirements) |
| 155 os.path.join(ROOT, '.wheelcache'), '-f', ipath] + requirements) | |
| 156 | 155 |
| 157 | 156 |
| 158 def activate_env(env, deps, quiet=False): | 157 def activate_env(env, deps, quiet=False): |
| 159 if hasattr(sys, 'real_prefix'): | 158 if hasattr(sys, 'real_prefix'): |
| 160 LOGGER.error('Already activated environment!') | 159 LOGGER.error('Already activated environment!') |
| 161 return | 160 return |
| 162 | 161 |
| 163 if not quiet: | 162 if not quiet: |
| 164 print 'Activating environment: %r' % env | 163 print 'Activating environment: %r' % env |
| 165 assert isinstance(deps, dict) | 164 assert isinstance(deps, dict) |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 opts = parser.parse_args(args) | 249 opts = parser.parse_args(args) |
| 251 | 250 |
| 252 deps = merge_deps(opts.deps_file) | 251 deps = merge_deps(opts.deps_file) |
| 253 activate_env(opts.env_path, deps, opts.quiet) | 252 activate_env(opts.env_path, deps, opts.quiet) |
| 254 | 253 |
| 255 | 254 |
| 256 if __name__ == '__main__': | 255 if __name__ == '__main__': |
| 257 logging.basicConfig() | 256 logging.basicConfig() |
| 258 LOGGER.setLevel(logging.DEBUG) | 257 LOGGER.setLevel(logging.DEBUG) |
| 259 sys.exit(main(sys.argv[1:])) | 258 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |