scons: make python includes a list and sensitive to platform specific directories - closes #1691 and fixes mapnik/mapnik-packaging#66
This commit is contained in:
parent
2aeb0da813
commit
7c5693c169
1 changed files with 12 additions and 3 deletions
15
SConstruct
15
SConstruct
|
@ -963,6 +963,7 @@ if not preconfigured:
|
||||||
env['PLUGINS'] = PLUGINS
|
env['PLUGINS'] = PLUGINS
|
||||||
env['EXTRA_FREETYPE_LIBS'] = []
|
env['EXTRA_FREETYPE_LIBS'] = []
|
||||||
env['SQLITE_LINKFLAGS'] = []
|
env['SQLITE_LINKFLAGS'] = []
|
||||||
|
env['PYTHON_INCLUDES'] = []
|
||||||
# previously a leading / was expected for LIB_DIR_NAME
|
# previously a leading / was expected for LIB_DIR_NAME
|
||||||
# now strip it to ensure expected behavior
|
# now strip it to ensure expected behavior
|
||||||
if env['LIB_DIR_NAME'].startswith(os.path.sep):
|
if env['LIB_DIR_NAME'].startswith(os.path.sep):
|
||||||
|
@ -1350,7 +1351,14 @@ if not preconfigured:
|
||||||
py_includes = '''%s -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())"''' % env['PYTHON']
|
py_includes = '''%s -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())"''' % env['PYTHON']
|
||||||
else:
|
else:
|
||||||
py_includes = '''%s -c "from distutils.sysconfig import get_python_inc; print get_python_inc()"''' % env['PYTHON']
|
py_includes = '''%s -c "from distutils.sysconfig import get_python_inc; print get_python_inc()"''' % env['PYTHON']
|
||||||
env['PYTHON_INCLUDES'] = call(py_includes)
|
env['PYTHON_INCLUDES'].append(call(py_includes))
|
||||||
|
|
||||||
|
# also append platform specific includes
|
||||||
|
if py3:
|
||||||
|
py_plat_includes = '''%s -c "from distutils.sysconfig import get_python_inc; print(get_python_inc(plat_specific=True))"''' % env['PYTHON']
|
||||||
|
else:
|
||||||
|
py_plat_includes = '''%s -c "from distutils.sysconfig import get_python_inc; print get_python_inc(plat_specific=True)"''' % env['PYTHON']
|
||||||
|
env['PYTHON_INCLUDES'].append(call(py_plat_includes))
|
||||||
|
|
||||||
# Note: we use the plat_specific argument here to make sure to respect the arch-specific site-packages location
|
# Note: we use the plat_specific argument here to make sure to respect the arch-specific site-packages location
|
||||||
if py3:
|
if py3:
|
||||||
|
@ -1361,7 +1369,7 @@ if not preconfigured:
|
||||||
else:
|
else:
|
||||||
env['PYTHON_SYS_PREFIX'] = os.popen('''%s -c "import sys; print sys.prefix"''' % env['PYTHON']).read().strip()
|
env['PYTHON_SYS_PREFIX'] = os.popen('''%s -c "import sys; print sys.prefix"''' % env['PYTHON']).read().strip()
|
||||||
env['PYTHON_VERSION'] = os.popen('''%s -c "import sys; print sys.version"''' % env['PYTHON']).read()[0:3]
|
env['PYTHON_VERSION'] = os.popen('''%s -c "import sys; print sys.version"''' % env['PYTHON']).read()[0:3]
|
||||||
env['PYTHON_INCLUDES'] = env['PYTHON_SYS_PREFIX'] + '/include/python' + env['PYTHON_VERSION']
|
env['PYTHON_INCLUDES'] = [env['PYTHON_SYS_PREFIX'] + '/include/python' + env['PYTHON_VERSION']]
|
||||||
env['PYTHON_SITE_PACKAGES'] = env['DESTDIR'] + os.path.sep + env['PYTHON_SYS_PREFIX'] + os.path.sep + env['LIBDIR_SCHEMA'] + '/python' + env['PYTHON_VERSION'] + '/site-packages/'
|
env['PYTHON_SITE_PACKAGES'] = env['DESTDIR'] + os.path.sep + env['PYTHON_SYS_PREFIX'] + os.path.sep + env['LIBDIR_SCHEMA'] + '/python' + env['PYTHON_VERSION'] + '/site-packages/'
|
||||||
|
|
||||||
# if user-requested custom prefix fall back to manual concatenation for building subdirectories
|
# if user-requested custom prefix fall back to manual concatenation for building subdirectories
|
||||||
|
@ -1527,7 +1535,8 @@ if not preconfigured:
|
||||||
# as they are later set in the python build.py
|
# as they are later set in the python build.py
|
||||||
# ugly hack needed until we have env specific conf
|
# ugly hack needed until we have env specific conf
|
||||||
backup = env.Clone().Dictionary()
|
backup = env.Clone().Dictionary()
|
||||||
env.AppendUnique(CPPPATH = os.path.realpath(env['PYTHON_INCLUDES']))
|
for pyinc in env['PYTHON_INCLUDES']:
|
||||||
|
env.AppendUnique(CPPPATH = os.path.realpath(pyinc))
|
||||||
|
|
||||||
if not conf.CheckHeader(header='Python.h',language='C'):
|
if not conf.CheckHeader(header='Python.h',language='C'):
|
||||||
color_print(1,'Could not find required header files for the Python language (version %s)' % env['PYTHON_VERSION'])
|
color_print(1,'Could not find required header files for the Python language (version %s)' % env['PYTHON_VERSION'])
|
||||||
|
|
Loading…
Reference in a new issue