1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
From db45d22173d427eee3d673dc63b60b12c206b31d Mon Sep 17 00:00:00 2001
From: Sparky Bluefang <sparky@bluefang-logic.com>
Date: Sun, 23 Jun 2024 17:10:47 -0400
Subject: [PATCH] Allow installing gi override to multiple python installations
---
meson_options.txt | 9 +++++++--
pygobject/meson.build | 33 +++++++++++++++++++++------------
2 files changed, 28 insertions(+), 14 deletions(-)
diff --git a/meson_options.txt b/meson_options.txt
index 3ea5310..ccee240 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -9,10 +9,15 @@ option('deprecated_warnings',
description: 'Show build warnings for deprecations'
)
option('py-overrides-dir',
- type : 'string',
- value : '',
+ type : 'array',
+ value : [],
description: 'Path to pygobject overrides directory'
)
+option('python_target',
+ type: 'array',
+ value: ['python3'],
+ description: 'Python installation to target to lookup if py-overrides-dir not supplied'
+)
option('status-notifier',
type: 'boolean',
value: true,
diff --git a/pygobject/meson.build b/pygobject/meson.build
index da219f7..d5ffc09 100644
--- a/pygobject/meson.build
+++ b/pygobject/meson.build
@@ -3,22 +3,31 @@ pygobject = dependency('pygobject-3.0',
required: true,
)
-override_dir = get_option('py-overrides-dir')
+override_dirs = get_option('py-overrides-dir')
-if override_dir == ''
- exec = find_program(['python3', 'python'])
+if override_dirs.length() == 0 or override_dirs[0] == ''
+ override_dirs = []
- r = run_command(exec, '-c', 'import gi;print(gi._overridesdir)', check: false)
+ pymod = import('python')
+ python_targets = get_option('python_target')
- if r.returncode() != 0
- error('Error getting the GObject Introspection override directory: ' + r.stderr())
- endif
+ foreach python_target : python_targets
+ python_install = pymod.find_installation(python_target)
- override_dir = r.stdout().strip()
+ r = run_command(python_install, '-c', 'import gi;print(gi._overridesdir)', check: false)
+
+ if r.returncode() != 0
+ error('Error getting the GObject Introspection override directory: ' + r.stderr())
+ endif
+
+ override_dirs += r.stdout().strip()
+ endforeach
endif
-message('PyGObject overrides dir: ' + override_dir)
+message('PyGObject overrides dirs: @0@'.format(override_dirs))
-install_data(['XApp.py'],
- install_dir: override_dir,
-)
+foreach override_dir : override_dirs
+ install_data(['XApp.py'],
+ install_dir: override_dir,
+ )
+endforeach
|