commit:     345a4b1cd1d77d1db99515bc64a71ee546142294
Author:     Marek Szuba <marecki <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 31 22:54:14 2020 +0000
Commit:     Marek Szuba <marecki <AT> gentoo <DOT> org>
CommitDate: Tue Mar 31 23:03:39 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=345a4b1c

dev-libs/libjcat: better control over build-time Python used

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 <AT> gentoo.org>

 .../files/libjcat-0.1.0-use_right_python.patch     | 29 ++++++++++++++++++++++
 dev-libs/libjcat/libjcat-0.1.0.ebuild              |  1 +
 2 files changed, 30 insertions(+)

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
index 00000000000..9cbc63a08c0
--- /dev/null
+++ b/dev-libs/libjcat/files/libjcat-0.1.0-use_right_python.patch
@@ -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@',

diff --git a/dev-libs/libjcat/libjcat-0.1.0.ebuild 
b/dev-libs/libjcat/libjcat-0.1.0.ebuild
index 32863148cd1..0956f965a22 100644
--- a/dev-libs/libjcat/libjcat-0.1.0.ebuild
+++ b/dev-libs/libjcat/libjcat-0.1.0.ebuild
@@ -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() {

Reply via email to