mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-21 15:56:42 +00:00
meson: Fix pythondetector on Debian and use sysconfig for getting the ABIFLAGS too
Paths like /usr/lib/python3.5/config-3.5m-x86_64-linux-gnu would not be detected by the old code, but it's all nicely stored in sysconfig so let's just use that.
This commit is contained in:
parent
2f0bd77249
commit
1b60fedc31
1 changed files with 5 additions and 29 deletions
|
@ -8,12 +8,7 @@ from distutils import sysconfig
|
|||
|
||||
|
||||
def get_python_abiflags():
|
||||
try:
|
||||
return subprocess.check_output([os.path.basename(sys.executable) + '-config',
|
||||
'--abiflags']).decode(errors='ignore').strip()
|
||||
except FileNotFoundError:
|
||||
return ''
|
||||
|
||||
return sysconfig.get_config_var("ABIFLAGS")
|
||||
|
||||
def get_python_libloc():
|
||||
# OSX is a pain. Python as shipped by apple installs libpython in /usr/lib
|
||||
|
@ -22,30 +17,11 @@ def get_python_libloc():
|
|||
if platform.system().lower() == 'darwin':
|
||||
return '/usr/lib'
|
||||
|
||||
python_libs = sysconfig.get_python_lib(standard_lib=1)
|
||||
pylib_loc = python_libs + '/config'
|
||||
pyversion = "%d.%d" % (sys.version_info.major, sys.version_info.minor)
|
||||
pylib_loc = sysconfig.get_config_var("LIBPL")
|
||||
pylib_ldlibrary = sysconfig.get_config_var("LDLIBRARY")
|
||||
|
||||
abiflags = get_python_abiflags()
|
||||
py_sharedlib = pylib_loc + '/libpython' + pyversion + abiflags + '.so'
|
||||
if os.path.exists(os.path.join(py_sharedlib)):
|
||||
return pylib_loc
|
||||
|
||||
pylib_loc = sys.prefix + '/lib64'
|
||||
py_sharedlib = pylib_loc + '/libpython' + pyversion + abiflags + '.so'
|
||||
|
||||
if os.path.exists(os.path.join(py_sharedlib)):
|
||||
return pylib_loc
|
||||
|
||||
pylib_loc = sys.prefix + '/lib'
|
||||
py_sharedlib = pylib_loc + '/libpython' + pyversion + abiflags + '.so'
|
||||
if os.path.exists(os.path.join(py_sharedlib)):
|
||||
return pylib_loc
|
||||
|
||||
libdir = 'lib64' if os.path.isdir('/usr/lib64') else 'lib'
|
||||
pylib_loc = '/usr/' + libdir
|
||||
py_sharedlib = pylib_loc + '/libpython' + pyversion + abiflags + '.so'
|
||||
if os.path.exists(os.path.join(py_sharedlib)):
|
||||
py_sharedlib = os.path.join(pylib_loc, pylib_ldlibrary)
|
||||
if os.path.exists(py_sharedlib):
|
||||
return pylib_loc
|
||||
|
||||
return "None"
|
||||
|
|
Loading…
Reference in a new issue