Re: [PATCH 3 of 7 stable] packaging: introduce Python3 support as buildrpm --python3

2019-10-27 Thread Mads Kiilerich
Some of the changes in this series can perhaps wait, but it could 
perhaps also be nice to take it step further and match how deb packaging 
already moved everything to py3 ...


/Mads
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 3 of 7 stable] packaging: introduce Python3 support as buildrpm --python3

2019-10-27 Thread Mads Kiilerich
# HG changeset patch
# User Mads Kiilerich 
# Date 1572208106 -3600
#  Sun Oct 27 21:28:26 2019 +0100
# Branch stable
# Node ID 32dbdaffb2ae030119890e05b87c4677706e7c6a
# Parent  6ce451ed79a3132bb6390210ca460a106d40b6db
packaging: introduce Python3 support as buildrpm --python3

Just overrule the HGPYTHON3 warning.

diff --git a/contrib/packaging/buildrpm b/contrib/packaging/buildrpm
--- a/contrib/packaging/buildrpm
+++ b/contrib/packaging/buildrpm
@@ -11,6 +11,7 @@
 
 BUILD=1
 RPMBUILDDIR="$PWD/rpmbuild"
+PYTHONEXE=python2
 
 while [ "$1" ]; do
 case "$1" in
@@ -18,6 +19,10 @@ while [ "$1" ]; do
 shift
 BUILD=
 ;;
+--python3)
+shift
+PYTHONEXE=python3
+;;
 --withpython | --with-python)
 shift
 PYTHONVER=2.7.16
@@ -96,6 +101,7 @@ rpmspec=$RPMBUILDDIR/SPECS/mercurial.spe
 
 sed -e "s,^Version:.*,Version: $version," \
 -e "s,^Release:.*,Release: $release," \
+-e "s/^%global pythonexe .*/%global pythonexe $PYTHONEXE/" \
 $specfile > $rpmspec
 
 echo >> $rpmspec
diff --git a/contrib/packaging/mercurial.spec b/contrib/packaging/mercurial.spec
--- a/contrib/packaging/mercurial.spec
+++ b/contrib/packaging/mercurial.spec
@@ -38,8 +38,8 @@ BuildRequires: make, gcc, gettext
 %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 @@ sed -i '1c#! /usr/bin/env %{pythonexe}' 
 
 %build
 
+export HGPYTHON3=1
+
 %if "%{?withpython}"
 
 PYPATH=$PWD/%{pythonname}
@@ -91,6 +93,8 @@ sed -i -e '1s|#!/usr/bin/env python$|#!/
 %install
 rm -rf $RPM_BUILD_ROOT
 
+export HGPYTHON3=1
+
 %if "%{?withpython}"
 
 PYPATH=$PWD/%{pythonname}

___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel