From: Sergei Trofimovich <sly...@gentoo.org>

The changes are mostly:
- 'print foo' -> 'print(foo)'
- conversion to explicit byte/string API

Unfortunately this change drops python2 support.

Signed-off-by: Sergei Trofimovich <sly...@gentoo.org>
---
 utils/gen-changelog.py   | 18 +++++++++---------
 utils/gen-tarball.py     |  6 +++---
 utils/gen-tree-hashes.py |  8 ++++----
 3 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/utils/gen-changelog.py b/utils/gen-changelog.py
index b539088a..2f30e4bc 100755
--- a/utils/gen-changelog.py
+++ b/utils/gen-changelog.py
@@ -7,7 +7,7 @@ prevrelease = "HEAD"
 prevdate = "Not released"
 prevtreehash = "HEAD"
 
-for line in check_output("git log --pretty=format:'%t\t%an\t%ai\t%s'", 
shell=True).split("\n"):
+for line in check_output("git log --pretty=format:'%t\t%an\t%ai\t%s'", 
shell=True).decode('utf-8', "replace").split("\n"):
     line = line.strip()
     if not line:
         continue
@@ -28,21 +28,21 @@ for line in check_output("git log 
--pretty=format:'%t\t%an\t%ai\t%s'", shell=Tru
             prevtreehash = treehash
             prevdate = date.split()[0]
             continue
-        print "Changes between %s and %s" % (subject, prevrelease)
+        print("Changes between %s and %s" % (subject, prevrelease))
         print
-        print " Release date: %s" % prevdate
-        print " Authors contributing to this release: %d" % len(authorchanges)
-        print " Number of changesets: %d" % sum(map(len, 
authorchanges.values()))
-        print " Number of files in this release: %s" % check_output("git 
ls-tree -r %s | wc -l" % prevtreehash, shell=True).strip()
+        print(" Release date: %s" % prevdate)
+        print(" Authors contributing to this release: %d" % len(authorchanges))
+        print(" Number of changesets: %d" % sum(map(len, 
authorchanges.values())))
+        print(" Number of files in this release: %s" % check_output("git 
ls-tree -r %s | wc -l" % prevtreehash, shell=True).decode().strip())
         print
-        authors = authorchanges.keys()
+        authors = list(authorchanges.keys())
         authors.sort()
         for a in authors:
-            print " %s:" % a
+            print(" %s:" % a)
             changes = authorchanges[a]
             changes.sort()
             for c in changes:
-                print "  * %s" % c
+                print("  * %s" % c)
             print
         print
         print
diff --git a/utils/gen-tarball.py b/utils/gen-tarball.py
index 3608e9ac..9d55036f 100755
--- a/utils/gen-tarball.py
+++ b/utils/gen-tarball.py
@@ -24,7 +24,7 @@ def add_files(ball, prefix, template, files):
         if os.path.exists(path):
             os.unlink(path)
 
-        fd = file(path, "w+")
+        fd = open(path, "wb+")
         fd.write(content)
         fd.close()
 
@@ -32,13 +32,13 @@ def add_files(ball, prefix, template, files):
         for key, value in template.items():
             setattr(tinfo, key, value)
 
-        fd = file(path)
+        fd = open(path, "rb")
         tfile.addfile(tinfo, fileobj=fd)
         fd.close()
 
     tfile.close()
 
-VERSION = check_output(["git", "describe"]).strip()
+VERSION = check_output(["git", "describe"]).decode().strip()
 
 # TODO: derive paths from submodule configuration
 TUTORIAL_DIR="doc/tutorial"
diff --git a/utils/gen-tree-hashes.py b/utils/gen-tree-hashes.py
index 2f0dc55b..4af5dd98 100755
--- a/utils/gen-tree-hashes.py
+++ b/utils/gen-tree-hashes.py
@@ -6,7 +6,7 @@ import os
 def collect_hashes(*paths):
     hashes = []
     for path in paths:
-        data = check_output("git --git-dir=%s/.git ls-tree -r HEAD" % path, 
shell=True)
+        data = check_output("git --git-dir=%s/.git ls-tree -r HEAD" % path, 
shell=True).decode()
         for line in data.split("\n"):
             line = line.strip()
             if line:
@@ -19,6 +19,6 @@ def collect_hashes(*paths):
 
     return "\n".join(result)
 
-print check_output("git describe", shell=True)
-print collect_hashes(".", "doc/tutorial")
-print collect_hashes(".", "src/lib/s4")
+print(check_output("git describe", shell=True).decode())
+print(collect_hashes(".", "doc/tutorial"))
+print(collect_hashes(".", "src/lib/s4"))
-- 
2.13.0


--
_______________________________________________
Xmms2-devel mailing list
Xmms2-devel@lists.xmms2.org
https://lists.xmms2.org/cgi-bin/mailman/listinfo/xmms2-devel

Reply via email to