OLD | NEW |
1 # Copyright 2013 The Swarming Authors. All rights reserved. | 1 # Copyright 2013 The Swarming Authors. All rights reserved. |
2 # Use of this source code is governed by the Apache v2.0 license that can be | 2 # Use of this source code is governed by the Apache v2.0 license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Set of functions to work with GAE SDK tools.""" | 5 """Set of functions to work with GAE SDK tools.""" |
6 | 6 |
7 import collections | 7 import collections |
8 import getpass | 8 import getpass |
9 import glob | 9 import glob |
10 import hashlib | 10 import hashlib |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 raise ValueError('setup_gae_sdk was already called.') | 149 raise ValueError('setup_gae_sdk was already called.') |
150 _GAE_SDK_PATH = sdk_path | 150 _GAE_SDK_PATH = sdk_path |
151 | 151 |
152 sys.path.insert(0, sdk_path) | 152 sys.path.insert(0, sdk_path) |
153 # Sadly, coverage may inject google.protobuf in the path. Forcibly expulse it. | 153 # Sadly, coverage may inject google.protobuf in the path. Forcibly expulse it. |
154 if 'google' in sys.modules: | 154 if 'google' in sys.modules: |
155 del sys.modules['google'] | 155 del sys.modules['google'] |
156 | 156 |
157 import dev_appserver | 157 import dev_appserver |
158 dev_appserver.fix_sys_path() | 158 dev_appserver.fix_sys_path() |
| 159 for i in sys.path[:]: |
| 160 if 'jinja2-2.6' in i: |
| 161 sys.path.remove(i) |
159 | 162 |
160 # Make 'yaml' variable (defined on top of this module) point to loaded module. | 163 # Make 'yaml' variable (defined on top of this module) point to loaded module. |
161 global yaml | 164 global yaml |
162 import yaml as yaml_module | 165 import yaml as yaml_module |
163 yaml = yaml_module | 166 yaml = yaml_module |
164 | 167 |
165 | 168 |
166 def gae_sdk_path(): | 169 def gae_sdk_path(): |
167 """Checks that 'setup_gae_sdk' was called and returns a path to GAE SDK.""" | 170 """Checks that 'setup_gae_sdk' was called and returns a path to GAE SDK.""" |
168 if not _GAE_SDK_PATH: | 171 if not _GAE_SDK_PATH: |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 print >> sys.stderr, 'Failed to unlock keyring: %s' % e | 618 print >> sys.stderr, 'Failed to unlock keyring: %s' % e |
616 return False | 619 return False |
617 | 620 |
618 | 621 |
619 def setup_gae_env(): | 622 def setup_gae_env(): |
620 """Sets up App Engine Python test environment.""" | 623 """Sets up App Engine Python test environment.""" |
621 sdk_path = find_gae_sdk(PYTHON_GAE_SDK) | 624 sdk_path = find_gae_sdk(PYTHON_GAE_SDK) |
622 if not sdk_path: | 625 if not sdk_path: |
623 raise RuntimeError('Couldn\'t find GAE SDK.') | 626 raise RuntimeError('Couldn\'t find GAE SDK.') |
624 setup_gae_sdk(sdk_path) | 627 setup_gae_sdk(sdk_path) |
OLD | NEW |