summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2012-12-17 12:34:07 -0500
committerJakub Steiner <jimmac@gmail.com>2013-01-02 13:49:58 +0100
commit575f6452e2a972525f53c7e7e12a07acc57587dd (patch)
treeabdc05ddfed30f91b31415476bd2fad8733ec1db
parent2af6b37dd153a097362f216f963ada9d71b39862 (diff)
downloadadwaita-icon-theme-575f6452e2a972525f53c7e7e12a07acc57587dd.tar.gz
Port to python3
https://bugzilla.gnome.org/show_bug.cgi?id=690363
-rwxr-xr-xrender-icon-theme.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/render-icon-theme.py b/render-icon-theme.py
index 7888e45ad..2c61b594c 100755
--- a/render-icon-theme.py
+++ b/render-icon-theme.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
import os
import sys
@@ -69,7 +69,7 @@ class ContentHandler(xml.sax.ContentHandler):
self.inside.append(self.SVG)
return
elif self.inside[-1] == self.SVG:
- if (name == "g" and attrs.has_key('inkscape:groupmode') and attrs.has_key('inkscape:label')
+ if (name == "g" and ('inkscape:groupmode' in attrs) and ('inkscape:label' in attrs)
and attrs['inkscape:groupmode'] == 'layer' and attrs['inkscape:label'].startswith('baseplate')):
self.stack.append(self.LAYER)
self.inside.append(self.LAYER)
@@ -78,13 +78,13 @@ class ContentHandler(xml.sax.ContentHandler):
self.rects = []
return
elif self.inside[-1] == self.LAYER:
- if name == "text" and attrs.has_key('inkscape:label') and attrs['inkscape:label'] == 'context':
+ if name == "text" and ('inkscape:label' in attrs) and attrs['inkscape:label'] == 'context':
self.stack.append(self.TEXT)
self.inside.append(self.TEXT)
self.text='context'
self.chars = ""
return
- elif name == "text" and attrs.has_key('inkscape:label') and attrs['inkscape:label'] == 'icon-name':
+ elif name == "text" and ('inkscape:label' in attrs) and attrs['inkscape:label'] == 'icon-name':
self.stack.append(self.TEXT)
self.inside.append(self.TEXT)
self.text='icon-name'
@@ -115,7 +115,7 @@ class ContentHandler(xml.sax.ContentHandler):
if self.filter is not None and not self.icon_name in self.filter:
return
- print '%s %s' % (self.context, self.icon_name)
+ print (self.context, ' ', self.icon_name)
for rect in self.rects:
width = rect['width']
height = rect['height']
@@ -147,7 +147,7 @@ class ContentHandler(xml.sax.ContentHandler):
if len(sys.argv) == 1:
if not os.path.exists('gnome'):
os.mkdir('gnome')
- print 'Rendering from SVGs in %s' % SRC
+ print ('Rendering from SVGs in ', SRC)
for file in os.listdir(SRC):
if file[-4:] == '.svg':
file = os.path.join(SRC, file)
@@ -163,7 +163,7 @@ else:
handler = ContentHandler(file, True, filter=icons)
xml.sax.parse(open(file), handler)
else:
- print "Error: No such file %s" % file
+ print ("Error: No such file ", file)
sys.exit(1)