dev-libs/libjcat: better control over build-time Python used
authorMarek Szuba <marecki@gentoo.org>
Tue, 31 Mar 2020 22:54:14 +0000 (23:54 +0100)
committerMarek Szuba <marecki@gentoo.org>
Tue, 31 Mar 2020 23:03:39 +0000 (00:03 +0100)
libjcat/meson.build calls a helper Python script which depends on
modules 'sys' (core, always present), 'xml' (core, controlled by USE=xml)
and 'pkg_resources' (from dev-python/setuptools) - using whatever Python
version /usr/bin/python3 points to, which may well provide neither of
the latter two modules. Make sure the helper script is invoked using the
Python interpreter used to run meson itself, as that one is guaranteed
to both provide XML support (the very same import line appears all over
the package mesonbuild) and have setuptools (it's in RDEPEND of
dev-util/meson).

Closes: https://bugs.gentoo.org/715670
Signed-off-by: Marek Szuba <marecki@gentoo.org>
dev-libs/libjcat/files/libjcat-0.1.0-use_right_python.patch [new file with mode: 0644]
dev-libs/libjcat/libjcat-0.1.0.ebuild

diff --git a/dev-libs/libjcat/files/libjcat-0.1.0-use_right_python.patch b/dev-libs/libjcat/files/libjcat-0.1.0-use_right_python.patch
new file mode 100644 (file)
index 0000000..9cbc63a
--- /dev/null
@@ -0,0 +1,29 @@
+By default generate-version-script.py uses /usr/bin/python3, whatever
+version that may be - which causes problems if the default python3
+installation is one either built without XML support or not included
+in PYTHON_TARGETS of dev-python/setuptools. Make sure the script is
+invoked using the same interpreter as meson itself, as that one is
+already guaranteed to provide both 'xml' and 'pkg_resources'.
+
+--- a/libjcat/meson.build
++++ b/libjcat/meson.build
+@@ -129,6 +129,11 @@
+     install : true,
+   )
++  # Make sure generate-version-script.py is invoked by the same python as meson,
++  # as that one must already have both XML support and setuptools.
++  python = import('python')
++  python_interpreter = python.find_installation()
++
+   # Verify the map file is correct -- note we can't actually use the generated
+   # file for two reasons:
+   #
+@@ -141,6 +146,7 @@
+     input: jcat_gir[0],
+     output: 'jcat.map',
+     command: [
++      python_interpreter,
+       join_paths(meson.source_root(), 'contrib', 'generate-version-script.py'),
+       'LIBJCAT',
+       '@INPUT@',
index 32863148cd11b75e860decb4cf6e06ea93cb9a28..0956f965a22b3072559031f55f20cbed09184a9f 100644 (file)
@@ -33,6 +33,7 @@ RESTRICT="!test? ( test )"
 
 PATCHES=(
        "${FILESDIR}"/${PN}-0.1.0-disable_installed_tests.patch
+       "${FILESDIR}"/${PN}-0.1.0-use_right_python.patch
 )
 
 src_prepare() {