changeset 43342:a6dcac6454c1 stable

packaging: introduce Python3 support as buildrpm --python3 Just overrule the HGPYTHON3 warning.
author Mads Kiilerich <mads@kiilerich.com>
date Sun, 27 Oct 2019 21:28:26 +0100
parents 92a51a45d44c
children 73d1bbf817cd
files contrib/packaging/buildrpm contrib/packaging/mercurial.spec
diffstat 2 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/packaging/buildrpm	Sun Oct 27 21:40:21 2019 +0100
+++ b/contrib/packaging/buildrpm	Sun Oct 27 21:28:26 2019 +0100
@@ -11,6 +11,7 @@
 
 BUILD=1
 RPMBUILDDIR="$PWD/rpmbuild"
+PYTHONEXE=python2
 
 while [ "$1" ]; do
     case "$1" in
@@ -18,6 +19,10 @@
         shift
         BUILD=
         ;;
+    --python3)
+        shift
+        PYTHONEXE=python3
+        ;;
     --withpython | --with-python)
         shift
         PYTHONVER=2.7.16
@@ -96,6 +101,7 @@
 
 sed -e "s,^Version:.*,Version: $version," \
     -e "s,^Release:.*,Release: $release," \
+    -e "s/^%global pythonexe .*/%global pythonexe $PYTHONEXE/" \
     $specfile > $rpmspec
 
 echo >> $rpmspec
--- a/contrib/packaging/mercurial.spec	Sun Oct 27 21:40:21 2019 +0100
+++ b/contrib/packaging/mercurial.spec	Sun Oct 27 21:28:26 2019 +0100
@@ -38,8 +38,8 @@
 %if "%{?withpython}"
 BuildRequires: readline-devel, openssl-devel, ncurses-devel, zlib-devel, bzip2-devel
 %else
-BuildRequires: python >= 2.7, python-devel, python-docutils >= 0.5
-Requires: python >= 2.7
+BuildRequires: python >= %{pythonver}, python-devel, python-docutils >= 0.5
+Requires: python >= %{pythonver}
 %endif
 # The hgk extension uses the wish tcl interpreter, but we don't enforce it
 #Requires: tk
@@ -60,6 +60,8 @@
 
 %build
 
+export HGPYTHON3=1
+
 %if "%{?withpython}"
 
 PYPATH=$PWD/%{pythonname}
@@ -91,6 +93,8 @@
 %install
 rm -rf $RPM_BUILD_ROOT
 
+export HGPYTHON3=1
+
 %if "%{?withpython}"
 
 PYPATH=$PWD/%{pythonname}