diff options
-rw-r--r-- | gps/fake.py | 27 | ||||
-rw-r--r-- | gpsfake.xml | 6 | ||||
-rwxr-xr-x | regress-driver | 7 |
3 files changed, 28 insertions, 12 deletions
diff --git a/gps/fake.py b/gps/fake.py index d3e4bd0d..a9c37cf3 100644 --- a/gps/fake.py +++ b/gps/fake.py @@ -282,16 +282,27 @@ class DaemonInstance: def spawn(self, options, port, background=False, prefix=""): "Spawn a daemon instance." self.spawncmd = None - if not '/usr/sbin' in os.environ['PATH']: - os.environ['PATH']=os.environ['PATH'] + ":/usr/sbin" - for path in os.environ['PATH'].split(':'): - _spawncmd = "%s/gpsd" % path - if os.path.isfile(_spawncmd) and os.access(_spawncmd, os.X_OK): - self.spawncmd = _spawncmd - break + + # Look for gpsd in GPSD_HOME env variable + if os.environ['GPSD_HOME'] : + for path in os.environ['GPSD_HOME'].split(':'): + _spawncmd = "%s/gpsd" % path + if os.path.isfile(_spawncmd) and os.access(_spawncmd, os.X_OK): + self.spawncmd = _spawncmd + break + + # if we could not find it yet try PATH env variable for it + if not self.spawncmd: + if not '/usr/sbin' in os.environ['PATH']: + os.environ['PATH']=os.environ['PATH'] + ":/usr/sbin" + for path in os.environ['PATH'].split(':'): + _spawncmd = "%s/gpsd" % path + if os.path.isfile(_spawncmd) and os.access(_spawncmd, os.X_OK): + self.spawncmd = _spawncmd + break if not self.spawncmd: - raise DaemonError("Cannot execute gpsd: executable not found.") + raise DaemonError("Cannot execute gpsd: executable not found. Set GPSD_HOME env variable") # The -b option to suppress hanging on probe returns is needed to cope # with OpenBSD (and possibly other non-Linux systems) that don't support # anything we can use to implement the FakeGPS.read() method diff --git a/gpsfake.xml b/gpsfake.xml index cbeb8e95..17b6dd0a 100644 --- a/gpsfake.xml +++ b/gpsfake.xml @@ -160,6 +160,12 @@ be retrieved using <application>gpspipe</application>, <application>gpscat</application>, or <application>gpsmon</application> from the gpsd distribution, or any other application which is able to create a compatible output.</para> + +<para>If <application>gpsfake</application> exits with "Cannot execute +gpsd: executable not found." the environment variable GPSD_HOME can be +set to the path where gpsd can be found. (instead of adding that folder +to the PATH envirnment variable</para> + </refsect1> <refsect1 id='see_also'><title>SEE ALSO</title> <para> diff --git a/regress-driver b/regress-driver index 81c615ef..6cc040cc 100755 --- a/regress-driver +++ b/regress-driver @@ -8,12 +8,11 @@ # Should return an empty blank string if tose are not present. starttime=`date +"%s" 2>/dev/null` -# We need to have the build directory in $PATH to find the new gpsd -# in case there is one in $PATH somewhere else in the system. +# We need to have the build directory in $GPSD_HOME to find the new gpsd if [ "`dirname $0`" = "." ]; then - PATH=`pwd`:${PATH} + GPSD_HOME=`pwd` else - PATH=`dirname $0`:${PATH} + GPSD_HOME=`dirname $0` fi # Arrange to call a gpsfake in the source directory without fuss. |