diff options
author | Patrick Griffis <pgriffis@igalia.com> | 2021-07-28 16:58:27 -0500 |
---|---|---|
committer | Patrick Griffis <tingping@tingping.se> | 2021-08-08 19:01:31 +0000 |
commit | 6d2bfc0701349cfae9e81414ceb42dd2919985d3 (patch) | |
tree | 533aa3bcb9b6c07f7722b4e9d38a5510cd070f44 /libsoup/meson.build | |
parent | a8a44b5cc82fe646425a2ed1ad96799894727103 (diff) | |
download | libsoup-6d2bfc0701349cfae9e81414ceb42dd2919985d3.tar.gz |
Add pygobject overrides
This makes SoupMessageHeaders usage more pythonic and could be
expanded upon later.
Diffstat (limited to 'libsoup/meson.build')
-rw-r--r-- | libsoup/meson.build | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/libsoup/meson.build b/libsoup/meson.build index bb4417ca..2176ce8a 100644 --- a/libsoup/meson.build +++ b/libsoup/meson.build @@ -289,3 +289,34 @@ if enable_introspection or enable_vapi ) endif endif + + +# We want to find the subdirectory to install our override into: +pymod = import('python') +python3 = pymod.find_installation('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): # Should always be True.. + overridedir = overridedir[len(libdir) + 1:] +print(overridedir) +''' + +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 + +install_data('Soup.py', install_dir: pygobject_override_dir) |