gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gpsd-dev] [PATCH 3/4] Removes build-time dependency on 'python2'.


From: Fred Wright
Subject: [gpsd-dev] [PATCH 3/4] Removes build-time dependency on 'python2'.
Date: Tue, 15 Mar 2016 16:52:11 -0700

Since some systems lack a 'python2' command, the switch to 'python2'
in the shebang lines can cause failures.  This fix gets around it by
explicitly invoking $PYTHON for all Python tools (except valgrind.py,
which already gets the versioned shebang line).  It also exports
$PYTHON to the environment, so that regress-driver can do the same
instead of defaulting to 'python2'.

If scons becomes Python3-compatible before GPSD does, or if GPSD
becomes pickier about Python versions than scons, some additional code
will be needed to find a suitable Python version, but for now just
using the same Python as scons is adequate (and is already what was
being done for some programs, just not all).

This does *not* address the issue of the *installed* Python programs
not working without 'python2'.  That's left for a separate change.

TESTED:
Verified that "scons build-all check" now works without a 'python2' in
the command path, both with and without coveraging.
---
 SConstruct | 5 +++--
 build.txt  | 4 ----
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/SConstruct b/SConstruct
index f464910..1eb80a9 100644
--- a/SConstruct
+++ b/SConstruct
@@ -256,6 +256,7 @@ for (name, default, help) in pathopts:
 
 env['VERSION'] = gpsd_version
 env['PYTHON'] = sys.executable
+env['ENV']['PYTHON'] = sys.executable  # Also pass it to regress-driver
 
 # Set defaults from environment.  Note that scons doesn't cope well
 # with multi-word CPPFLAGS/LDFLAGS/SHLINKFLAGS values; you'll have to
@@ -1579,7 +1580,7 @@ else:
     # SCons to install up to date versions of gpsfake and gpsctl if it can
     # find older versions of them in a directory on your $PATH.
     gps_herald = Utility('gps-herald', [gpsd, gpsctl, python_built_extensions],
-                         ':; $PYTHON_COVERAGE $SRCDIR/gpsfake -T')
+                         ':; $PYTHON $PYTHON_COVERAGE $SRCDIR/gpsfake -T')
     gps_log_pattern = os.path.join('test', 'daemon', '*.log')
     gps_logs = glob.glob(gps_log_pattern)
     gps_names = [os.path.split(x)[-1][:-4] for x in gps_logs]
@@ -1733,7 +1734,7 @@ if not env['python']:
 else:
     maidenhead_locator_regress = Utility('maidenhead-locator-regress', 
[python_built_extensions], [
         '@echo "Testing the Maidenhead Locator conversion..."',
-        '$PYTHON_COVERAGE $SRCDIR/test_maidenhead.py >/dev/null',
+        '$PYTHON $PYTHON_COVERAGE $SRCDIR/test_maidenhead.py >/dev/null',
         ])
 
 # Regression-test the calendar functions
diff --git a/build.txt b/build.txt
index ef7916b..7627192 100644
--- a/build.txt
+++ b/build.txt
@@ -60,10 +60,6 @@ Necessary components for any build:
 |scons              | for executing the build recipe
 |============================================================================
 
-Note: There must be a Python 2 interpreter named 'python2' in your path,
-or the regression tests will fail.  On some systems you might need to
-arrange this by putting symlink in a local directory on $PATH.
-
 === C compiler ===
 
 C99 conformance is required in the compiler. The C code depends on one
-- 
2.7.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]