62 lines
2.1 KiB
Diff
62 lines
2.1 KiB
Diff
From 696cad7df63dad0ba89a9f2fdfdd05cdf02c0ada Mon Sep 17 00:00:00 2001
|
|
From: Colin Walters <walters@verbum.org>
|
|
Date: Mon, 16 Jul 2018 15:05:37 -0400
|
|
Subject: [PATCH] build-sys: Use python3 for libdnf by default if available
|
|
|
|
Probably at some point libdnf will drop py2 support, but the
|
|
main reason I'm doing this is avoids a python2 dependency
|
|
for rpm-ostree for distributions that don't want that.
|
|
---
|
|
configure.ac | 22 ++++++++++++++++++++++
|
|
1 file changed, 22 insertions(+)
|
|
|
|
diff --git a/configure.ac b/configure.ac
|
|
index 66c4a933..043115a6 100644
|
|
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -113,6 +113,23 @@ AS_IF([pkg-config --atleast-version=4.13.0.1 rpm], [
|
|
|
|
AC_PATH_PROG([XSLTPROC], [xsltproc])
|
|
|
|
+dnl This was painful to figure out; it's sad that Automake's
|
|
+dnl python support doesn't do a better job of optionally supporting
|
|
+dnl both 2 and 3. Anyways the logic here is: Honor $PYTHON if set
|
|
+dnl uncondionally, otherwise try python3 if it appears to be available
|
|
+dnl first, then fall back to 2.
|
|
+dnl Recommendation is explicit PYTHON=python3 ./configure ...
|
|
+AS_IF([test -z "$PYTHON"], [
|
|
+ AS_IF([test -x /usr/bin/python3], [
|
|
+ AM_PATH_PYTHON([3.6])
|
|
+ ], [
|
|
+ AM_PATH_PYTHON([2.7])
|
|
+ ])
|
|
+])
|
|
+dnl http://maemo.org/maemo_training_material/maemo4.x/html/maemo_Application_Development_Chinook/Chapter_05_GNU_Autotools.html
|
|
+dnl incorrectly says the quoted ']' is @>:@ (...crying...)
|
|
+pyver=$($PYTHON -c "import sys; sys.stdout.write(sys.version @<:@ :3 @:>@ )")
|
|
+
|
|
GLIB_TESTS
|
|
LIBGLNX_CONFIGURE
|
|
|
|
@@ -226,6 +243,10 @@ else
|
|
export cmake_args
|
|
fi
|
|
|
|
+case $pyver in
|
|
+ 3.*) cmake_args="${cmake_args} -DPYTHON_DESIRED:str=3";;
|
|
+esac
|
|
+
|
|
dnl I picked /usr/libexec/rpm-ostree just because we need an
|
|
dnl arbitrary path - we don't actually install there.
|
|
(set -euo pipefail; mkdir -p libdnf-build && cd libdnf-build &&
|
|
@@ -257,5 +278,6 @@ echo "
|
|
introspection: $found_introspection
|
|
bubblewrap: $with_bubblewrap
|
|
gtk-doc: $enable_gtk_doc
|
|
+ python: $PYTHON $pyver
|
|
rust: $enable_rust
|
|
"
|
|
--
|
|
2.17.1
|
|
|