Commit bdbbfd6c authored by Corentin Noël's avatar Corentin Noël Committed by Corentin Noël
Browse files

python: Use meson functions to install the GObject Introspection overrides

parent c6162d8a
...@@ -292,6 +292,7 @@ configure_file(output: 'config.h', configuration: config_h) ...@@ -292,6 +292,7 @@ configure_file(output: 'config.h', configuration: config_h)
gnome = import('gnome') gnome = import('gnome')
i18n = import('i18n') i18n = import('i18n')
pkgconfig = import('pkgconfig') pkgconfig = import('pkgconfig')
pymod = import('python')
subdir('data') subdir('data')
subdir('src') subdir('src')
......
...@@ -17,8 +17,6 @@ option('network_tests', type: 'boolean', value: true, description: 'Allow networ ...@@ -17,8 +17,6 @@ option('network_tests', type: 'boolean', value: true, description: 'Allow networ
option('ctags_path', type: 'string', value: '') option('ctags_path', type: 'string', value: '')
option('python_libprefix', type: 'string')
option('plugin_autotools', type: 'boolean') option('plugin_autotools', type: 'boolean')
option('plugin_beautifier', type: 'boolean') option('plugin_beautifier', type: 'boolean')
option('plugin_c_pack', type: 'boolean') option('plugin_c_pack', type: 'boolean')
......
...@@ -22,45 +22,5 @@ subdir('greeter') ...@@ -22,45 +22,5 @@ subdir('greeter')
subdir('webkit') subdir('webkit')
subdir('tree') subdir('tree')
# We want to find the subdirectory to install our override into: py_installation = pymod.find_installation('python3')
python_libprefix = get_option('python_libprefix') py_installation.install_sources('Ide.py', subdir: 'gi' / 'overrides')
if python_libprefix != ''
pygobject_override_dir = join_paths(get_option('libdir'), python_libprefix, 'site-packages', 'gi', 'overrides')
else
python3 = find_program('python3')
get_overridedir = '''
import os
import sysconfig
libdir = sysconfig.get_config_var('LIBDIR')
if not libdir:
libdir = '/usr/lib'
try:
import gi
overridedir = gi._overridesdir
except ImportError:
purelibdir = sysconfig.get_path('purelib')
overridedir = os.path.join(purelibdir, 'gi', 'overrides')
if overridedir.startswith(libdir):
overridedir = overridedir[len(libdir) + 1:]
elif overridedir.startswith('@0@'):
# Do nothing if its in our same prefix
pass
else:
overridedir = overridedir[len('/usr/lib') + 1:]
print(overridedir)
'''.format(get_option('prefix'))
ret = run_command([python3, '-c', get_overridedir])
if ret.returncode() != 0
error('Failed to determine pygobject overridedir')
else
pygobject_override_dir = join_paths(get_option('libdir'), ret.stdout().strip())
endif
endif
install_data('Ide.py', install_dir: pygobject_override_dir)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment