[gnome-builder/wip/tintou/python-overrides] python: Use meson functions to install the GObject Introspection overrides



commit bdbbfd6cec5589c743cc65da334d16e4196b7c04
Author: Corentin Noël <corentin noel collabora com>
Date:   Wed May 13 10:31:30 2020 +0200

    python: Use meson functions to install the GObject Introspection overrides

 meson.build            |  1 +
 meson_options.txt      |  2 --
 src/libide/meson.build | 44 ++------------------------------------------
 3 files changed, 3 insertions(+), 44 deletions(-)
---
diff --git a/meson.build b/meson.build
index 288a6e0d5..d5837a116 100644
--- a/meson.build
+++ b/meson.build
@@ -292,6 +292,7 @@ configure_file(output: 'config.h', configuration: config_h)
 gnome = import('gnome')
 i18n = import('i18n')
 pkgconfig = import('pkgconfig')
+pymod = import('python')
 
 subdir('data')
 subdir('src')
diff --git a/meson_options.txt b/meson_options.txt
index f187c821f..352a91dad 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -17,8 +17,6 @@ option('network_tests', type: 'boolean', value: true, description: 'Allow networ
 
 option('ctags_path', type: 'string', value: '')
 
-option('python_libprefix', type: 'string')
-
 option('plugin_autotools', type: 'boolean')
 option('plugin_beautifier', type: 'boolean')
 option('plugin_c_pack', type: 'boolean')
diff --git a/src/libide/meson.build b/src/libide/meson.build
index 3412c50c9..9223a37f4 100644
--- a/src/libide/meson.build
+++ b/src/libide/meson.build
@@ -22,45 +22,5 @@ subdir('greeter')
 subdir('webkit')
 subdir('tree')
 
-# We want to find the subdirectory to install our override into:
-python_libprefix = get_option('python_libprefix')
-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)
+py_installation = pymod.find_installation('python3')
+py_installation.install_sources('Ide.py', subdir: 'gi' / 'overrides')


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]