changeset 43340:e0812b032bcc stable

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.
author Mads Kiilerich <mads@kiilerich.com>
date Sun, 27 Oct 2019 20:17:33 +0100
parents 1a0d419ec763
children 92a51a45d44c
files contrib/packaging/buildrpm contrib/packaging/mercurial.spec
diffstat 2 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/packaging/buildrpm	Wed Oct 30 21:49:48 2019 +0900
+++ b/contrib/packaging/buildrpm	Sun Oct 27 20:17:33 2019 +0100
@@ -121,8 +121,8 @@
     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 @@
 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
--- a/contrib/packaging/mercurial.spec	Wed Oct 30 21:49:48 2019 +0900
+++ b/contrib/packaging/mercurial.spec	Sun Oct 27 20:17:33 2019 +0100
@@ -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