Commit e6662560 authored by Stefan H. Holek's avatar Stefan H. Holek

Forward port recent mods from 2.7 branch.

parent 6e008d50
...@@ -369,23 +369,21 @@ class ImmediateTestRunner(unittest.TextTestRunner): ...@@ -369,23 +369,21 @@ class ImmediateTestRunner(unittest.TextTestRunner):
class PathInit: class PathInit:
def __init__(self, build, libdir=None): def __init__(self, build, libdir=None):
# Calculate which directories we're going to add to sys.path. # Calculate which directories we're going to add to sys.path.
self.libdir = "lib/python" self.libdir = os.path.join('lib', 'python')
# Hack sys.path # Hack sys.path
self.home = os.path.dirname(os.path.realpath(sys.argv[0])) self.home = os.path.dirname(os.path.realpath(sys.argv[0]))
# test.py lives in $ZOPE_HOME/bin when installed ... # test.py lives in $ZOPE_HOME/bin when installed ...
dir, file = os.path.split(self.home) dir, file = os.path.split(self.home)
if file == 'bin': self.home = dir if file == 'bin': self.home = dir
sys.path.insert(0, os.path.join(self.home, self.libdir)) sys.path.insert(0, os.path.join(self.home, self.libdir))
sys.path.insert(0, os.path.join(self.home, self.libdir, 'third_party', 'docutils'))
self.cwd = os.path.realpath(os.getcwd()) self.cwd = os.path.realpath(os.getcwd())
# Hack again for external products. # Hack again for external products.
if libdir: if libdir:
self.libdir = os.path.join(self.cwd, libdir) self.libdir = os.path.realpath(os.path.join(self.cwd, libdir))
else: else:
self.libdir = os.path.join(self.cwd, self.libdir) self.libdir = os.path.realpath(os.path.join(self.cwd, self.libdir))
real_libdir = os.path.realpath(self.libdir) if self.libdir not in sys.path:
if real_libdir not in sys.path: sys.path.insert(0, self.libdir)
sys.path.insert(0, real_libdir)
# Determine where to look for tests # Determine where to look for tests
if test_dir: if test_dir:
self.testdir = os.path.abspath(os.path.join(self.cwd, test_dir)) self.testdir = os.path.abspath(os.path.join(self.cwd, test_dir))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment