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

Side by Side Diff: bootstrap/virtualenv/virtualenv_embedded/activate_this.py

Issue 1205873002: Re-land: Added virtualenv for depot_tools (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Restore cd commands Created 5 years, 5 months 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 """By using execfile(this_file, dict(__file__=this_file)) you will
2 activate this virtualenv environment.
3
4 This can be used when you must use an existing Python interpreter, not
5 the virtualenv bin/python
6 """
7
8 try:
9 __file__
10 except NameError:
11 raise AssertionError(
12 "You must run this like execfile('path/to/activate_this.py', dict(__file __='path/to/activate_this.py'))")
13 import sys
14 import os
15
16 old_os_path = os.environ.get('PATH', '')
17 os.environ['PATH'] = os.path.dirname(os.path.abspath(__file__)) + os.pathsep + o ld_os_path
18 base = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
19 if sys.platform == 'win32':
20 site_packages = os.path.join(base, 'Lib', 'site-packages')
21 else:
22 site_packages = os.path.join(base, 'lib', 'python%s' % sys.version[:3], 'sit e-packages')
23 prev_sys_path = list(sys.path)
24 import site
25 site.addsitedir(site_packages)
26 sys.real_prefix = sys.prefix
27 sys.prefix = base
28 # Move the added items to the front of the path:
29 new_sys_path = []
30 for item in list(sys.path):
31 if item not in prev_sys_path:
32 new_sys_path.append(item)
33 sys.path.remove(item)
34 sys.path[:0] = new_sys_path
OLDNEW
« no previous file with comments | « bootstrap/virtualenv/virtualenv_embedded/activate.sh ('k') | bootstrap/virtualenv/virtualenv_embedded/deactivate.bat » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698