mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-29 21:21:12 +00:00
meson: Install in gi._overidesdir only if we are installing in right prefix
And make sure python detector did not fail https://bugzilla.gnome.org/show_bug.cgi?id=780369
This commit is contained in:
parent
c32670e405
commit
7f78ed2541
2 changed files with 50 additions and 9 deletions
35
meson.build
35
meson.build
|
@ -22,14 +22,38 @@ pygobject_dep = dependency('pygobject-3.0', version : '>= 3.0')
|
||||||
python_dep = dependency('python3')
|
python_dep = dependency('python3')
|
||||||
|
|
||||||
python = find_program('python3')
|
python = find_program('python3')
|
||||||
pythondetector = find_program('pythondetector')
|
pythondetector = find_program('scripts/pythondetector')
|
||||||
py_so_suffix = run_command(pythondetector, '--sosuffix').stdout().strip()
|
|
||||||
python_abi_flags = run_command(pythondetector, '--abiflags').stdout().strip()
|
cres = run_command(pythondetector, '--sosuffix')
|
||||||
pylib_loc = run_command(pythondetector, '--libloc').stdout().strip()
|
if cres.returncode() != 0
|
||||||
|
error('Could not detect python sosuffix' + cres.stdout() + cres.stderr())
|
||||||
|
endif
|
||||||
|
py_so_suffix = cres.stdout().strip()
|
||||||
|
|
||||||
|
cres = run_command(pythondetector, '--abiflags')
|
||||||
|
if cres.returncode() != 0
|
||||||
|
error('Could not detect python abiflags' + cres.stdout() + cres.stderr())
|
||||||
|
endif
|
||||||
|
python_abi_flags = cres.stdout().strip()
|
||||||
|
|
||||||
|
cres = run_command(pythondetector, '--libloc')
|
||||||
|
if cres.returncode() != 0
|
||||||
|
error('Could not detect python library location' + cres.stdout() + cres.stderr())
|
||||||
|
endif
|
||||||
|
pylib_loc = cres.stdout().strip()
|
||||||
|
|
||||||
assert(pylib_loc != 'None', 'Python dynamic library path could not be determined')
|
assert(pylib_loc != 'None', 'Python dynamic library path could not be determined')
|
||||||
pygi_override_dir = get_option('pygi-overrides-dir')
|
pygi_override_dir = get_option('pygi-overrides-dir')
|
||||||
if pygi_override_dir == ''
|
if pygi_override_dir == ''
|
||||||
pygi_override_dir = run_command(pythondetector, '--pygi-overridedir').stdout().strip()
|
cres = run_command(pythondetector, '--pygi-overridedir',
|
||||||
|
get_option('prefix'))
|
||||||
|
if cres.returncode() != 0
|
||||||
|
error('Could not detect PyGObject overrides location' + cres.stdout() + cres.stderr())
|
||||||
|
endif
|
||||||
|
pygi_override_dir = cres.stdout().strip()
|
||||||
|
if cres.stderr() != ''
|
||||||
|
message(cres.stderr())
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
message('pygobject overrides directory ' + pygi_override_dir)
|
message('pygobject overrides directory ' + pygi_override_dir)
|
||||||
|
|
||||||
|
@ -39,7 +63,6 @@ if host_machine.system() == 'windows'
|
||||||
elif host_machine.system() == 'darwin'
|
elif host_machine.system() == 'darwin'
|
||||||
pylib_suffix = 'dylib'
|
pylib_suffix = 'dylib'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
cdata = configuration_data()
|
cdata = configuration_data()
|
||||||
cdata.set('PACKAGE', '"gst-python"')
|
cdata.set('PACKAGE', '"gst-python"')
|
||||||
cdata.set('VERSION', '"@0@"'.format(gst_version))
|
cdata.set('VERSION', '"@0@"'.format(gst_version))
|
||||||
|
|
|
@ -36,8 +36,8 @@ def get_python_libloc():
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
if len(sys.argv) > 2:
|
if len(sys.argv) > 3:
|
||||||
print("Only 1 argument accepted")
|
print("At most 2 arguments accepted")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
if sys.argv[1] == '--abiflags':
|
if sys.argv[1] == '--abiflags':
|
||||||
|
@ -47,7 +47,25 @@ if __name__ == "__main__":
|
||||||
suffix = get("EXT_SUFFIX") or get("SO") or ".so"
|
suffix = get("EXT_SUFFIX") or get("SO") or ".so"
|
||||||
print(suffix[1:])
|
print(suffix[1:])
|
||||||
elif sys.argv[1] == '--pygi-overridedir':
|
elif sys.argv[1] == '--pygi-overridedir':
|
||||||
|
prefix = sys.argv[2]
|
||||||
|
version = sys.version_info
|
||||||
|
|
||||||
|
# If we are installing in the same prefix as PyGobject
|
||||||
|
# make sure to install in the right place.
|
||||||
import gi
|
import gi
|
||||||
print(gi._overridesdir)
|
if os.path.commonprefix([gi._overridesdir, prefix]) == prefix:
|
||||||
|
print(gi._overridesdir)
|
||||||
|
exit(0)
|
||||||
|
|
||||||
|
# Otherwise follow python's way of install site packages inside
|
||||||
|
# the provided prefix
|
||||||
|
if os.name == 'posix':
|
||||||
|
print(os.path.join(
|
||||||
|
prefix, 'lib', 'python%d.%d' % (version.major, version.minor),
|
||||||
|
'site-packages', 'gi', 'overrides'))
|
||||||
|
else:
|
||||||
|
print(os.path.join(
|
||||||
|
prefix, 'Lib', 'Python%d%d' % (version.major, version.minor),
|
||||||
|
'site-packages', 'gi', 'overrides'))
|
||||||
elif sys.argv[1] == '--libloc':
|
elif sys.argv[1] == '--libloc':
|
||||||
print(get_python_libloc())
|
print(get_python_libloc())
|
Loading…
Reference in a new issue