~ubuntu-branches/ubuntu/quantal/enigmail/quantal-security

« back to all changes in this revision

Viewing changes to mozilla/python/virtualenv/virtualenv_embedded/activate_this.py

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2013-09-13 16:02:15 UTC
  • mfrom: (0.12.16)
  • Revision ID: package-import@ubuntu.com-20130913160215-u3g8nmwa0pdwagwc
Tags: 2:1.5.2-0ubuntu0.12.10.1
* New upstream release v1.5.2 for Thunderbird 24

* Build enigmail using a stripped down Thunderbird 17 build system, as it's
  now quite difficult to build the way we were doing previously, with the
  latest Firefox build system
* Add debian/patches/no_libxpcom.patch - Don't link against libxpcom, as it
  doesn't exist anymore (but exists in the build system)
* Add debian/patches/use_sdk.patch - Use the SDK version of xpt.py and
  friends
* Drop debian/patches/ipc-pipe_rename.diff (not needed anymore)
* Drop debian/patches/makefile_depth.diff (not needed anymore)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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['PATH']
 
17
os.environ['PATH'] = os.path.dirname(os.path.abspath(__file__)) + os.pathsep + old_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], 'site-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