-# Find Python include and library directories for embedding the
-# interpreter. For consistency, we will use the same Python
-# installation used to run scons (and thus this script). If you want
-# to link in an alternate version, see above for instructions on how
-# to invoke scons with a different copy of the Python interpreter.
-from distutils import sysconfig
-
-py_getvar = sysconfig.get_config_var
-
-py_debug = getattr(sys, 'pydebug', False)
-py_version = 'python' + py_getvar('VERSION') + (py_debug and "_d" or "")
-
-py_general_include = sysconfig.get_python_inc()
-py_platform_include = sysconfig.get_python_inc(plat_specific=True)
-py_includes = [ py_general_include ]
-if py_platform_include != py_general_include:
- py_includes.append(py_platform_include)
-
-py_lib_path = [ py_getvar('LIBDIR') ]
-# add the prefix/lib/pythonX.Y/config dir, but only if there is no
-# shared library in prefix/lib/.
-if not py_getvar('Py_ENABLE_SHARED'):
- py_lib_path.append(py_getvar('LIBPL'))
- # Python requires the flags in LINKFORSHARED to be added the
- # linker flags when linking with a statically with Python. Failing
- # to do so can lead to errors from the Python's dynamic module
- # loader at start up.
- main.Append(LINKFLAGS=[py_getvar('LINKFORSHARED').split()])
-
-py_libs = []
-for lib in py_getvar('LIBS').split() + py_getvar('SYSLIBS').split():
- if not lib.startswith('-l'):
- # Python requires some special flags to link (e.g. -framework
- # common on OS X systems), assume appending preserves order
- main.Append(LINKFLAGS=[lib])
- else:
- lib = lib[2:]
- if lib not in py_libs:
- py_libs.append(lib)
-py_libs.append(py_version)
-
-main.Append(CPPPATH=py_includes)
-main.Append(LIBPATH=py_lib_path)
-