diff options
author | Bernd Zeimetz <bernd@bzed.de> | 2010-04-16 01:54:22 +0200 |
---|---|---|
committer | Bernd Zeimetz <bernd@bzed.de> | 2010-04-16 01:54:22 +0200 |
commit | 0b543cecedab3e8b87cb7c4c7da935b26a2750cf (patch) | |
tree | 3df402ec8989bc1bc2778f088db3fca0dd272c0c /regress-driver | |
parent | 4c17d82c06fdfde6f15a4dec91e1498fd7f1f6c6 (diff) | |
download | gpsd-0b543cecedab3e8b87cb7c4c7da935b26a2750cf.tar.gz |
regress-driver: Simplify PATH/PYTHONPATH evaluation.
This also ensures that we don't need to add . to $PATH. Adding
`dirname $0` in case we don't have scripts in
build/scripts-$python_version should be enough.
Diffstat (limited to 'regress-driver')
-rwxr-xr-x | regress-driver | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/regress-driver b/regress-driver index 0d281725..77622f68 100755 --- a/regress-driver +++ b/regress-driver @@ -5,25 +5,19 @@ # drivers. # Arrange to call a gpsfake in the source directory without fuss. -# Add the current directory to $PATH -PATH=`pwd`:$PATH - -# Use built Python files if available - instead of using -# those which were installed somewhere in the system. -if [ -d build ]; then - if [ -z ${PYTHON} ]; then - PYTHON="python" - fi - libdir=`pwd`/build/`${PYTHON} -c 'import distutils.util; import sys; print "lib.%s-%s" %(distutils.util.get_platform(), sys.version[0:3])'` - scriptdir=`pwd`/build/`${PYTHON} -c 'import sys; print "scripts-%s" %(sys.version[0:3], )'` - if [ -d ${libdir} ] && [ -d ${scriptdir} ]; then - PYTHONPATH=${libdir} - export PYTHONPATH - - PATH=${scriptdir}:${PATH} - fi +if [ -z ${PYTHON} ]; then + PYTHON="python" fi +py_libdir=`pwd`/build/`${PYTHON} -c 'import distutils.util; import sys; print "lib.%s-%s" %(distutils.util.get_platform(), sys.version[0:3])'` +py_scriptdir=`pwd`/build/`${PYTHON} -c 'import sys; print "scripts-%s" %(sys.version[0:3], )'` +if [ -d ${py_libdir} ] && [ -d ${py_scriptdir} ]; then + PYTHONPATH=${py_libdir} + export PYTHONPATH + PATH=${py_scriptdir}:${PATH} +else + PATH=`dirname $0`:${PATH} +fi export PATH mode=regress |