Chromium Code Reviews| 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 logging | 8 import logging |
| 9 import os | 9 import os |
| 10 import shutil | 10 import shutil |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 138 | 138 |
| 139 if cur_deps is None: | 139 if cur_deps is None: |
| 140 print ' Building new environment' | 140 print ' Building new environment' |
| 141 # Add in bundled virtualenv lib | 141 # Add in bundled virtualenv lib |
| 142 sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'virtualenv')) | 142 sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'virtualenv')) |
| 143 import virtualenv # pylint: disable=F0401 | 143 import virtualenv # pylint: disable=F0401 |
| 144 virtualenv.create_environment( | 144 virtualenv.create_environment( |
| 145 env, search_dirs=virtualenv.file_search_dirs()) | 145 env, search_dirs=virtualenv.file_search_dirs()) |
| 146 | 146 |
| 147 print ' Activating environment' | 147 print ' Activating environment' |
| 148 activate_this = os.path.join(env, 'bin', 'activate_this.py') | 148 if not virtualenv.is_win: |
| 149 activate_this = os.path.join(env, 'bin', 'activate_this.py') | |
| 150 else: | |
| 151 activate_this = os.path.join(env, 'Scripts', 'activate_this.py') | |
|
iannucci
2014/08/15 17:38:40
thanks, I was meaning to do this but never got aro
anatoly techtonik
2014/08/15 19:36:11
Done.
| |
| 149 execfile(activate_this, dict(__file__=activate_this)) | 152 execfile(activate_this, dict(__file__=activate_this)) |
| 150 | 153 |
| 151 if cur_deps is None: | 154 if cur_deps is None: |
| 152 print ' Installing deps' | 155 print ' Installing deps' |
| 153 print_deps(deps, indent=2, with_implicit=False) | 156 print_deps(deps, indent=2, with_implicit=False) |
| 154 install(deps) | 157 install(deps) |
| 155 with open(manifest_path, 'wb') as f: | 158 with open(manifest_path, 'wb') as f: |
| 156 f.write(repr(deps) + '\n') | 159 f.write(repr(deps) + '\n') |
| 157 | 160 |
| 158 print 'Done creating environment' | 161 print 'Done creating environment' |
| 159 | 162 |
| 160 | 163 |
| 161 def main(args): | 164 def main(args): |
| 162 parser = argparse.ArgumentParser() | 165 parser = argparse.ArgumentParser() |
| 163 parser.add_argument('--deps_file', action='append', | 166 parser.add_argument('--deps_file', action='append', |
| 164 help='Path to deps.pyl file (may be used multiple times)') | 167 help='Path to deps.pyl file (may be used multiple times)') |
| 165 parser.add_argument('env_path', | 168 parser.add_argument('env_path', |
| 166 help='Path to place environment (default: %(default)s)', | 169 help='Path to place environment (default: %(default)s)', |
| 167 default='ENV') | 170 default='ENV') |
| 168 opts = parser.parse_args(args) | 171 opts = parser.parse_args(args) |
| 169 | 172 |
| 170 deps = merge_deps(opts.deps_file) | 173 deps = merge_deps(opts.deps_file) |
| 171 activate_env(opts.env_path, deps) | 174 activate_env(opts.env_path, deps) |
| 172 | 175 |
| 173 | 176 |
| 174 if __name__ == '__main__': | 177 if __name__ == '__main__': |
| 175 logging.basicConfig() | 178 logging.basicConfig() |
| 176 LOGGER.setLevel(logging.DEBUG) | 179 LOGGER.setLevel(logging.DEBUG) |
| 177 sys.exit(main(sys.argv[1:])) | 180 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |