1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
import sys
import os
from os.path import join
from distutils.sysconfig import get_python_lib
from site import addsitedir
root = sys.argv.pop(1)
site_packages = get_python_lib()
_path = sys.path[:]
sys.path[:] = []
addsitedir(join(root, site_packages[1:]))
addsitedir(join(root, site_packages[1:].replace('dist-packages', 'site-packages'))) # cdbs installs python modules in site-packages even for Python 2.6
sys.path.extend(_path)
# Some tests need PYTHONPATH. We provide a sensible value for it (although not really correct)
if 'PYTHONPATH' not in os.environ:
os.environ['PYTHONPATH'] = os.pathsep.join(sys.path)
from twisted.scripts.trial import run
run()
|