Make build python3-only compatible for distributions that want that
This commit is contained in:
parent
2a0fd3d7c1
commit
c92a606d60
@ -0,0 +1,61 @@
|
|||||||
|
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
|
||||||
|
|
@ -14,6 +14,7 @@ Release: 3%{?dist}
|
|||||||
# This tarball is generated via "cd packaging && make -f Makefile.dist-packaging dist-snapshot"
|
# This tarball is generated via "cd packaging && make -f Makefile.dist-packaging dist-snapshot"
|
||||||
# in the upstream git. If rust is enabled, it contains vendored sources.
|
# in the upstream git. If rust is enabled, it contains vendored sources.
|
||||||
Source0: rpm-ostree-%{version}.tar.xz
|
Source0: rpm-ostree-%{version}.tar.xz
|
||||||
|
Patch1: 0001-build-sys-Use-python3-for-libdnf-by-default-if-avail.patch
|
||||||
License: LGPLv2+
|
License: LGPLv2+
|
||||||
URL: https://github.com/projectatomic/rpm-ostree
|
URL: https://github.com/projectatomic/rpm-ostree
|
||||||
|
|
||||||
@ -53,12 +54,13 @@ BuildRequires: pkgconfig(librepo)
|
|||||||
BuildRequires: cmake
|
BuildRequires: cmake
|
||||||
BuildRequires: pkgconfig(expat)
|
BuildRequires: pkgconfig(expat)
|
||||||
BuildRequires: pkgconfig(check)
|
BuildRequires: pkgconfig(check)
|
||||||
BuildRequires: python2-devel
|
|
||||||
# https://github.com/CentOS/sig-atomic-buildscripts/issues/324
|
# https://github.com/CentOS/sig-atomic-buildscripts/issues/324
|
||||||
%if (0%{?rhel} != 0 && 0%{?rhel} <= 7)
|
%if (0%{?rhel} != 0 && 0%{?rhel} <= 7)
|
||||||
|
BuildRequires: python-devel
|
||||||
BuildRequires: python-sphinx
|
BuildRequires: python-sphinx
|
||||||
%else
|
%else
|
||||||
BuildRequires: python2-sphinx
|
BuildRequires: python3-sphinx
|
||||||
|
BuildRequires: python3-devel
|
||||||
%endif
|
%endif
|
||||||
%if (0%{?rhel} != 0 && 0%{?rhel} <= 7)
|
%if (0%{?rhel} != 0 && 0%{?rhel} <= 7)
|
||||||
BuildRequires: libsolv-devel
|
BuildRequires: libsolv-devel
|
||||||
@ -127,7 +129,6 @@ find $RPM_BUILD_ROOT -name '*.la' -delete
|
|||||||
# way the same spec file works more easily across multiple versions where e.g. an
|
# way the same spec file works more easily across multiple versions where e.g. an
|
||||||
# older version might not have a systemd unit file.
|
# older version might not have a systemd unit file.
|
||||||
cat > autofiles.py <<EOF
|
cat > autofiles.py <<EOF
|
||||||
#!/usr/bin/python
|
|
||||||
import os,sys,glob
|
import os,sys,glob
|
||||||
os.chdir(os.environ['RPM_BUILD_ROOT'])
|
os.chdir(os.environ['RPM_BUILD_ROOT'])
|
||||||
for line in sys.argv[1:]:
|
for line in sys.argv[1:]:
|
||||||
@ -143,7 +144,11 @@ for line in sys.argv[1:]:
|
|||||||
else:
|
else:
|
||||||
sys.stderr.write('{0} did not match any files\n'.format(line))
|
sys.stderr.write('{0} did not match any files\n'.format(line))
|
||||||
EOF
|
EOF
|
||||||
python autofiles.py > files \
|
PYTHON=python3
|
||||||
|
if ! test -x /usr/bin/python3; then
|
||||||
|
PYTHON=python2
|
||||||
|
fi
|
||||||
|
$PYTHON autofiles.py > files \
|
||||||
'%{_bindir}/*' \
|
'%{_bindir}/*' \
|
||||||
'%{_libdir}/%{name}' \
|
'%{_libdir}/%{name}' \
|
||||||
'%{_mandir}/man*/*' \
|
'%{_mandir}/man*/*' \
|
||||||
@ -154,11 +159,11 @@ python autofiles.py > files \
|
|||||||
'%{_datadir}/polkit-1/actions/*.policy' \
|
'%{_datadir}/polkit-1/actions/*.policy' \
|
||||||
'%{_datadir}/dbus-1/system-services'
|
'%{_datadir}/dbus-1/system-services'
|
||||||
|
|
||||||
python autofiles.py > files.lib \
|
$PYTHON autofiles.py > files.lib \
|
||||||
'%{_libdir}/*.so.*' \
|
'%{_libdir}/*.so.*' \
|
||||||
'%{_libdir}/girepository-1.0/*.typelib'
|
'%{_libdir}/girepository-1.0/*.typelib'
|
||||||
|
|
||||||
python autofiles.py > files.devel \
|
$PYTHON autofiles.py > files.devel \
|
||||||
'%{_libdir}/lib*.so' \
|
'%{_libdir}/lib*.so' \
|
||||||
'%{_includedir}/*' \
|
'%{_includedir}/*' \
|
||||||
'%{_datadir}/dbus-1/interfaces/org.projectatomic.rpmostree1.xml' \
|
'%{_datadir}/dbus-1/interfaces/org.projectatomic.rpmostree1.xml' \
|
||||||
@ -174,8 +179,8 @@ python autofiles.py > files.devel \
|
|||||||
%files devel -f files.devel
|
%files devel -f files.devel
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2018.6-3
|
* Mon Jul 16 2018 Colin Walters <walters@verbum.org> - 2018.6-3
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
- Make build python3-only compatible for distributions that want that
|
||||||
|
|
||||||
* Fri Jun 29 2018 Jonathan Lebon <jonathan@jlebon.com> - 2018.6-2
|
* Fri Jun 29 2018 Jonathan Lebon <jonathan@jlebon.com> - 2018.6-2
|
||||||
- Rebuild for yummy Rusty bitsy
|
- Rebuild for yummy Rusty bitsy
|
||||||
|
Loading…
Reference in New Issue
Block a user