File 0002-Build-Don-t-install-Python-overrides-by-default.patch of Package libaccounts-glib

From eac26830b73c74fcb0cfec96cab01c97358645fa Mon Sep 17 00:00:00 2001
From: "FeRD (Frank Dana)" <ferdnyc@gmail.com>
Date: Thu, 2 Feb 2023 16:59:18 -0500
Subject: [PATCH 2/8] Build: Don't install Python overrides by default

It's not clear when (if ever) it's necessary to install the
overrides file for Python's gobject introspection. A new option
'install-py-overrides' controls whether that install is attempted.
The option defaults to 'false', so installing the overrides will
now require adding `-Dinstall-py-overrides=true` to the initial
`meson` setup command.

Signed-off-by: FeRD (Frank Dana) <ferdnyc@gmail.com>
---
 libaccounts-glib/pygobject/meson.build | 31 ++++++++++++++++----------
 meson_options.txt                      |  1 +
 2 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/libaccounts-glib/pygobject/meson.build b/libaccounts-glib/pygobject/meson.build
index 955c78d..39ef700 100644
--- a/libaccounts-glib/pygobject/meson.build
+++ b/libaccounts-glib/pygobject/meson.build
@@ -1,19 +1,26 @@
 py_override = get_option('py-overrides-dir')
+install_overrides = get_option('install-py-overrides')
 
-if py_override == ''
-    python3 = import('python3')
-    python_exec = python3.find_python()
+if install_overrides
+    if py_override == ''
+        python3 = import('python3')
+        python_exec = python3.find_python()
 
-    python_exec_result = run_command(python_exec, ['-c', 'import gi; from os.path import abspath; print(abspath(gi._overridesdir))'])
+        python_exec_result = run_command(
+            python_exec, [
+                '-c',
+                'import gi; from os.path import abspath; print(abspath(gi._overridesdir))'
+            ])
 
-    if python_exec_result.returncode() != 0
-        error('Failed to retreive the python GObject override directory')
+        if python_exec_result.returncode() != 0
+            error('Failed to retreive the python GObject override directory')
+        endif
+
+        py_override = python_exec_result.stdout().strip()
     endif
 
-    py_override = python_exec_result.stdout().strip()
+    install_data(
+        'Accounts.py',
+        install_dir: py_override
+    )
 endif
-
-install_data(
-    'Accounts.py',
-    install_dir: py_override
-)
diff --git a/meson_options.txt b/meson_options.txt
index 2c33804..44161de 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1 +1,2 @@
+option('install-py-overrides', type: 'boolean', value: false, description: 'Install Python gi overrides file')
 option('py-overrides-dir', type : 'string', value : '', description: 'Path to pygobject overrides directory')
-- 
2.44.0

openSUSE Build Service is sponsored by