* subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c
[svn.git] / subversion / bindings / swig / python / tests / setup_path.py
blobe8ddd9aed375df8cca99b6c41ba4b74eee7543f1
1 # Set things up to use the bindings in the build directory.
2 # Used by the testsuite, but you may also run:
3 # $ python -i tests/setup_path.py
4 # to start an interactive interpreter.
6 import sys
7 import os
9 # os.getcwd() is used here to attempt to support VPATH builds -
10 # it is expected that the current directory be what 'make check-swig-py'
11 # arranges for it to be: i.e. BUILDDIR/subversion/bindings/swig/python .
12 src_swig_python_tests_dir = os.path.dirname(__file__)
13 bld_swig_python_dir = os.getcwd()
14 sys.path[0:0] = [ src_swig_python_tests_dir,
15 bld_swig_python_dir,
16 "%s/.libs" % bld_swig_python_dir,
17 "%s/.." % src_swig_python_tests_dir,
18 "%s/../.libs" % src_swig_python_tests_dir ]
20 # OSes without RPATH support are going to have to do things here to make
21 # the correct shared libraries be found.
22 if sys.platform == 'cygwin':
23 import glob
24 svndir = os.path.normpath("../../../%s" % bld_swig_python_dir)
25 libpath = os.getenv("PATH").split(":")
26 libpath.insert(0, "%s/libsvn_swig_py/.libs" % bld_swig_python_dir)
27 for libdir in glob.glob("%s/libsvn_*" % svndir):
28 libpath.insert(0, "%s/.libs" % (libdir))
29 os.putenv("PATH", ":".join(libpath))