summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2018-07-12 09:02:56 (GMT)
committerTobias Markmann <tm@ayena.de>2018-07-12 09:02:56 (GMT)
commit95b04304452c4cf0a01f676a12779dacc6fa51a4 (patch)
tree9a8dce3db8213b68901893a0a6d371243684c3ee /BuildTools/Gource
parent2bb40b14d3d7f5cebc56601dad066d5201040bd2 (diff)
downloadswift-95b04304452c4cf0a01f676a12779dacc6fa51a4.zip
swift-95b04304452c4cf0a01f676a12779dacc6fa51a4.tar.bz2
Fix Python 3 compatibility of our SCons and tooling Python code
For the upcoming update to Scons 3, which works with Python 2 and Python 3, this change makes our code compatible with Python 3 so that it still works with Python 2. Test-Information: Tested these changes with SCons 3.0.1 on macOS 10.13.6 with Python 2.7.15 and Python 3.7.0. Change-Id: Idb5207b179a79a0dbe89d7e620d182a7d2f1ca6c
Diffstat (limited to 'BuildTools/Gource')
-rwxr-xr-xBuildTools/Gource/GetGravatars.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/BuildTools/Gource/GetGravatars.py b/BuildTools/Gource/GetGravatars.py
index d1f40a4..17198aa 100755
--- a/BuildTools/Gource/GetGravatars.py
+++ b/BuildTools/Gource/GetGravatars.py
@@ -5,7 +5,7 @@ import subprocess, os, sys, hashlib, urllib
GRAVATAR_URL = "http://www.gravatar.com/avatar/%(id)s?d=404"
if len(sys.argv) != 2 :
- print "Usage: " + sys.argv[0] + " <output-dir>"
+ print("Usage: " + sys.argv[0] + " <output-dir>")
sys.exit(-1)
output_dir = sys.argv[1]
@@ -18,32 +18,32 @@ for line in p.stdout.readlines() :
authors[author_components[0]] = author_components[1]
p.stdin.close()
if p.wait() != 0 :
- print "Error"
+ print("Error")
sys.exit(-1)
# Get & save the avatars
if not os.path.isdir(output_dir) :
os.makedirs(output_dir)
for email, name in authors.items() :
- print "Processing avatar for " + name + " <" + email + ">"
+ print("Processing avatar for " + name + " <" + email + ">")
filename = os.path.join(output_dir, name + ".png")
if os.path.isfile(filename) :
- print "-> Already there. Skipping."
+ print("-> Already there. Skipping.")
continue
m = hashlib.md5()
m.update(email)
url = GRAVATAR_URL % {"id" : m.hexdigest()}
- print "- Downloading " + url
+ print("- Downloading " + url)
f = urllib.urlopen(url)
input = None
if f.getcode() == 200 :
input = f.read()
f.close()
if input :
- print "- Saving file " + filename
+ print("- Saving file " + filename)
f = open(filename, "w")
f.write(input)
f.close()
else :
- print "- No Gravatar found"
+ print("- No Gravatar found")