summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2018-09-14 19:56:57 -0700
committerGary E. Miller <gem@rellim.com>2018-09-14 19:56:57 -0700
commitddaf31e1d0ace924b95becc64325bb2a94e45d73 (patch)
treef4deabb25f6b1999d38e65566f911789519b58a2 /SConstruct
parent81d8df25d78175832a88c3416401f95311463234 (diff)
downloadgpsd-ddaf31e1d0ace924b95becc64325bb2a94e45d73.tar.gz
SConstruct: 2nd try to fix building with Python 3.
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct28
1 files changed, 16 insertions, 12 deletions
diff --git a/SConstruct b/SConstruct
index 6d6fa546..a131ec86 100644
--- a/SConstruct
+++ b/SConstruct
@@ -968,6 +968,16 @@ PYTHON_CONFIG_QUOTED = ["'%s'" % s for s in PYTHON_CONFIG_NAMES]
PYTHON_CONFIG_CALL = ('sysconfig.get_config_vars(%s)'
% ', '.join(PYTHON_CONFIG_QUOTED))
+
+# ugly hack from http://www.catb.org/esr/faqs/practical-python-porting/
+# handle python2/3 strings
+def polystr(o):
+ if isinstance(o, str):
+ return o
+ if isinstance(o, bytes):
+ return str(o, encoding='latin-1')
+ raise ValueError
+
if helping:
# If helping just get usable config info from the local Python
@@ -1002,8 +1012,12 @@ else:
brief=cleaning)
# follow FHS, put in /usr/local/libXX, not /usr/libXX
# may be lib, lib32 or lib64
- python_libdir = python_libdir.replace(b"/usr/lib",
- b"/usr/local/lib")
+ print(type(python_libdir))
+ python_libdir = polystr(python_libdir)
+ print(type(python_libdir))
+ print(type("/usr/lib"))
+ python_libdir = python_libdir.replace("/usr/lib",
+ "/usr/local/lib")
py_config_text = config.GetPythonValue('config vars',
PYTHON_SYSCONFIG_IMPORT,
@@ -1011,16 +1025,6 @@ else:
brief=True)
-# ugly hack from http://www.catb.org/esr/faqs/practical-python-porting/
-# handle python2/3 strings
-def polystr(o):
- if isinstance(o, str):
- return o
- if isinstance(o, bytes):
- return str(o, encoding='latin-1')
- raise ValueError
-
-
if env['python']: # May have been turned off by error
env['PYTHON'] = polystr(target_python_path)
env['ENV']['PYTHON'] = polystr(target_python_path) # For regress-driver