[PATCH 1 of 7 stable] packaging: make python snippets in rpm building python3 compatible
Mads Kiilerich
mads at kiilerich.com
Sun Oct 27 23:37:09 UTC 2019
# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1572203853 -3600
# Sun Oct 27 20:17:33 2019 +0100
# Branch stable
# Node ID 496bbefb8fa0f24c789ae98f0b37e98046acb83c
# Parent a2ff3aff81d244685cf2f25a1ee92f379d1d115c
packaging: make python snippets in rpm building python3 compatible
Fedora 31 has Python3 at /usr/bin/python, and buildrpm would fail on snippets
that use python2 syntax. Instead of forcing python2, just accept for the future
while staying backwards compatible.
diff --git a/contrib/packaging/buildrpm b/contrib/packaging/buildrpm
--- a/contrib/packaging/buildrpm
+++ b/contrib/packaging/buildrpm
@@ -121,8 +121,8 @@ for l in sorted(changelog, reverse=True)
if prevtitle != title:
prevtitle = title
print
- print title
- print "- %s" % l[3].strip()
+ print(title)
+ print("- %s" % l[3].strip())
' >> $rpmspec
else
@@ -138,7 +138,7 @@ def datestr(date, format):
for l in sys.stdin.readlines():
tok = l.split("\t")
hgdate = tuple(int(v) for v in tok[0].split())
- print "* %s %s\n- %s" % (datestr(hgdate, "%a %b %d %Y"), tok[1], tok[2])
+ print("* %s %s\n- %s" % (datestr(hgdate, "%a %b %d %Y"), tok[1], tok[2]))
' >> $rpmspec
fi
diff --git a/contrib/packaging/mercurial.spec b/contrib/packaging/mercurial.spec
--- a/contrib/packaging/mercurial.spec
+++ b/contrib/packaging/mercurial.spec
@@ -15,7 +15,7 @@
%else
-%global pythonver %(python -c 'import sys;print ".".join(map(str, sys.version_info[:2]))')
+%global pythonver %(python -c 'import sys;print(".".join(map(str, sys.version_info[:2])))')
%endif
More information about the Mercurial-devel
mailing list