Parag Nemade 8a7942
From 75426cbbe57138849b96537ab1dee81e7861af11 Mon Sep 17 00:00:00 2001
Parag Nemade 8a7942
From: Parag Nemade <pnemade@redhat.com>
Parag Nemade 8a7942
Date: Fri, 8 Apr 2016 12:03:12 +0530
Parag Nemade 8a7942
Subject: [PATCH] Add python3 support
Parag Nemade 8a7942
Parag Nemade 8a7942
---
Parag Nemade 8a7942
 pycontrib/FontCompare/fc/BitmapHandler.py    | 20 +++++++--------
Parag Nemade 8a7942
 pycontrib/FontCompare/fc/DocCompare.py       |  2 +-
Parag Nemade 8a7942
 pycontrib/FontCompare/fc/FontCompare.py      |  2 +-
Parag Nemade 8a7942
 pycontrib/FontCompare/fc/GlyphConsistency.py |  2 +-
Parag Nemade 8a7942
 pycontrib/FontCompare/fontcompare            |  2 +-
Parag Nemade 8a7942
 pycontrib/FontCompare/unittests/unittests.py | 18 ++++++-------
Parag Nemade 8a7942
 pycontrib/collab/web-test-collab.py          |  2 +-
Parag Nemade 8a7942
 pycontrib/even.py                            |  2 +-
Parag Nemade 8a7942
 pycontrib/gdraw/__init__.py                  |  2 +-
Parag Nemade 8a7942
 pycontrib/gdraw/gdraw.py                     | 18 ++++++-------
Parag Nemade 8a7942
 pycontrib/graphicore.py                      |  2 +-
Parag Nemade 8a7942
 pycontrib/graphicore/ipython_view.py         | 13 +++++-----
Parag Nemade 8a7942
 pycontrib/graphicore/shell.py                |  2 +-
Parag Nemade 8a7942
 pycontrib/svg2sfd.py                         | 38 ++++++++++++++--------------
Parag Nemade 8a7942
 pycontrib/webcollab.py                       |  2 +-
Parag Nemade 8a7942
 15 files changed, 64 insertions(+), 63 deletions(-)
Parag Nemade 8a7942
Parag Nemade 8a7942
diff --git a/pycontrib/FontCompare/fc/BitmapHandler.py b/pycontrib/FontCompare/fc/BitmapHandler.py
Parag Nemade 8a7942
index d4d00da..c159128 100644
Parag Nemade 8a7942
--- a/pycontrib/FontCompare/fc/BitmapHandler.py
Parag Nemade 8a7942
+++ b/pycontrib/FontCompare/fc/BitmapHandler.py
Parag Nemade 8a7942
@@ -35,7 +35,7 @@ def white_bg_square(img):
Parag Nemade 8a7942
     "return a white-background-color image having the img in exact center"
Parag Nemade 8a7942
     size = (max(img.size),)*2
Parag Nemade 8a7942
     layer = Image.new('1', size, 1)
Parag Nemade 8a7942
-    layer.paste(img, tuple(map(lambda x:(x[0]-x[1])/2, zip(size, img.size))))
Parag Nemade 8a7942
+    layer.paste(img, tuple([(x[0]-x[1])/2 for x in zip(size, img.size)]))
Parag Nemade 8a7942
     return layer
Parag Nemade 8a7942
 
Parag Nemade 8a7942
 class BitmapCompare:
Parag Nemade 8a7942
@@ -73,13 +73,13 @@ class CreateSpriteSheet:
Parag Nemade 8a7942
         #seperate each image with lots of whitespace
Parag Nemade 8a7942
         master_height = pixelsize
Parag Nemade 8a7942
         oldfont = font
Parag Nemade 8a7942
-        print "the master image will by %d by %d" % (master_width, master_height)
Parag Nemade 8a7942
-        print "creating image..."
Parag Nemade 8a7942
+        print("the master image will by %d by %d" % (master_width, master_height))
Parag Nemade 8a7942
+        print("creating image...")
Parag Nemade 8a7942
         master = Image.new(
Parag Nemade 8a7942
         mode='1',
Parag Nemade 8a7942
         size=(master_width, master_height),
Parag Nemade 8a7942
         color=0) # fully transparent
Parag Nemade 8a7942
-        print "created."
Parag Nemade 8a7942
+        print("created.")
Parag Nemade 8a7942
         if effects == "italic":
Parag Nemade 8a7942
             font.selection.all()
Parag Nemade 8a7942
             font = font.italicize(-13)
Parag Nemade 8a7942
@@ -92,16 +92,16 @@ class CreateSpriteSheet:
Parag Nemade 8a7942
                     font[i].changeWeight(50,"auto",0,0,"auto")
Parag Nemade 8a7942
                 font[i].export("temp.bmp",pixelsize,1)
Parag Nemade 8a7942
                 img = Image.open("temp.bmp")
Parag Nemade 8a7942
-                print "adding %s at %d..." % (str(i)+".bmp", location),
Parag Nemade 8a7942
+                print("adding %s at %d..." % (str(i)+".bmp", location), end=' ')
Parag Nemade 8a7942
                 square_one = white_bg_square(img)
Parag Nemade 8a7942
                 square_one.resize((pixelsize, pixelsize))
Parag Nemade 8a7942
                 master.paste(square_one,(location,0))
Parag Nemade 8a7942
-                print "added."
Parag Nemade 8a7942
+                print("added.")
Parag Nemade 8a7942
             except:
Parag Nemade 8a7942
-                print "ooopsy"
Parag Nemade 8a7942
+                print("ooopsy")
Parag Nemade 8a7942
             count+=1
Parag Nemade 8a7942
-        print "done adding pics."
Parag Nemade 8a7942
-        print "saving mastersprite.bmp..."
Parag Nemade 8a7942
+        print("done adding pics.")
Parag Nemade 8a7942
+        print("saving mastersprite.bmp...")
Parag Nemade 8a7942
         master.save('data/mastersprite'+effects+'.bmp' )
Parag Nemade 8a7942
-        print "saved!"
Parag Nemade 8a7942
+        print("saved!")
Parag Nemade 8a7942
         font.close()
Parag Nemade 8a7942
diff --git a/pycontrib/FontCompare/fc/DocCompare.py b/pycontrib/FontCompare/fc/DocCompare.py
Parag Nemade 8a7942
index 3a54bf9..df431e2 100644
Parag Nemade 8a7942
--- a/pycontrib/FontCompare/fc/DocCompare.py
Parag Nemade 8a7942
+++ b/pycontrib/FontCompare/fc/DocCompare.py
Parag Nemade 8a7942
@@ -41,7 +41,7 @@ class DocCompare:
Parag Nemade 8a7942
         bashcommand = "hb-view --output-format=\"png\" --output-file=\"/var/tmp/test.png\" --font-size="+str(fontsize)+" --text-file=\""
Parag Nemade 8a7942
         bashcommand+=docpath+"\" "+"\""+testpath+"\""
Parag Nemade 8a7942
         os.system(str(bashcommand))
Parag Nemade 8a7942
-        print bashcommand
Parag Nemade 8a7942
+        print(bashcommand)
Parag Nemade 8a7942
         thefile = pkg_resources.resource_filename("fc",mockfont.highresdocfile)
Parag Nemade 8a7942
         shutil.copy(thefile,"/var/tmp/standard.png")
Parag Nemade 8a7942
         cm = BitmapCompare()
Parag Nemade 8a7942
diff --git a/pycontrib/FontCompare/fc/FontCompare.py b/pycontrib/FontCompare/fc/FontCompare.py
Parag Nemade 8a7942
index f21718c..c82b788 100644
Parag Nemade 8a7942
--- a/pycontrib/FontCompare/fc/FontCompare.py
Parag Nemade 8a7942
+++ b/pycontrib/FontCompare/fc/FontCompare.py
Parag Nemade 8a7942
@@ -111,7 +111,7 @@ class FontCompare(object):
Parag Nemade 8a7942
         scores = list()
Parag Nemade 8a7942
         comparator = BitmapCompare()
Parag Nemade 8a7942
         pixelsize = (resolution*ptsize)/72
Parag Nemade 8a7942
-        print spritepath
Parag Nemade 8a7942
+        print(spritepath)
Parag Nemade 8a7942
         for i in range (glyphRange[0],glyphRange[1]):
Parag Nemade 8a7942
             if i in Testfont:
Parag Nemade 8a7942
                 Testfont[i].export("/var/tmp/tmp.bmp",pixelsize,1)
Parag Nemade 8a7942
diff --git a/pycontrib/FontCompare/fc/GlyphConsistency.py b/pycontrib/FontCompare/fc/GlyphConsistency.py
Parag Nemade 8a7942
index 38273c9..d5265fa 100644
Parag Nemade 8a7942
--- a/pycontrib/FontCompare/fc/GlyphConsistency.py
Parag Nemade 8a7942
+++ b/pycontrib/FontCompare/fc/GlyphConsistency.py
Parag Nemade 8a7942
@@ -102,7 +102,7 @@ class GlyphConsistency:
Parag Nemade 8a7942
         for i in range (glyphrange[0],glyphrange[1]):
Parag Nemade 8a7942
             if i in font:
Parag Nemade 8a7942
                 score =  self.glyph_round_compare(font[i],pixelsize)
Parag Nemade 8a7942
-                print score
Parag Nemade 8a7942
+                print(score)
Parag Nemade 8a7942
                 set_round_score+=score
Parag Nemade 8a7942
                 total+=1
Parag Nemade 8a7942
         font.close()
Parag Nemade 8a7942
diff --git a/pycontrib/FontCompare/fontcompare b/pycontrib/FontCompare/fontcompare
Parag Nemade 8a7942
index e7e68d8..fdf7336 100755
Parag Nemade 8a7942
--- a/pycontrib/FontCompare/fontcompare
Parag Nemade 8a7942
+++ b/pycontrib/FontCompare/fontcompare
Parag Nemade 8a7942
@@ -15,7 +15,7 @@
Parag Nemade 8a7942
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
Parag Nemade 8a7942
 """
Parag Nemade 8a7942
 
Parag Nemade 8a7942
-#! /usr/bin/python
Parag Nemade 8a7942
+#! /usr/bin/python3
Parag Nemade 8a7942
 from PyQt4.QtGui import QMessageBox
Parag Nemade 8a7942
 from PyQt4.QtGui import QMainWindow
Parag Nemade 8a7942
 from PyQt4.QtGui import QApplication
Parag Nemade 8a7942
diff --git a/pycontrib/FontCompare/unittests/unittests.py b/pycontrib/FontCompare/unittests/unittests.py
Parag Nemade 8a7942
index 18e1e95..d8a1190 100644
Parag Nemade 8a7942
--- a/pycontrib/FontCompare/unittests/unittests.py
Parag Nemade 8a7942
+++ b/pycontrib/FontCompare/unittests/unittests.py
Parag Nemade 8a7942
@@ -55,7 +55,7 @@ class Basictests(unittest.TestCase):
Parag Nemade 8a7942
         for tup in basic:
Parag Nemade 8a7942
             if tup[1]!=10:
Parag Nemade 8a7942
                 bastest=0
Parag Nemade 8a7942
-        self.failUnless(bastest)
Parag Nemade 8a7942
+        self.assertTrue(bastest)
Parag Nemade 8a7942
         testfont = fontforge.open("unittests/lohit.ttf")
Parag Nemade 8a7942
         bold = cm.font_facecompare(testfont,mockfont,(0x900,0x97f),\
Parag Nemade 8a7942
         600,12,1,"bold")
Parag Nemade 8a7942
@@ -66,28 +66,28 @@ class Basictests(unittest.TestCase):
Parag Nemade 8a7942
         normal = cm.font_facecompare(testfont,mockfont,(0x900,0x97f),\
Parag Nemade 8a7942
         600,12,1,"normal")
Parag Nemade 8a7942
         test = 1
Parag Nemade 8a7942
-        print len(normal)
Parag Nemade 8a7942
+        print(len(normal))
Parag Nemade 8a7942
         for tup in bold:
Parag Nemade 8a7942
             if tup[1]==100 or tup[1]==0:
Parag Nemade 8a7942
                 test1=1
Parag Nemade 8a7942
                 break
Parag Nemade 8a7942
-        self.failUnless(test)
Parag Nemade 8a7942
+        self.assertTrue(test)
Parag Nemade 8a7942
         test = 0
Parag Nemade 8a7942
         for tup in italic:
Parag Nemade 8a7942
             if tup[1]==100 or tup[1]==0:
Parag Nemade 8a7942
                 test=1
Parag Nemade 8a7942
                 break
Parag Nemade 8a7942
-        self.failUnless(test is 1)
Parag Nemade 8a7942
+        self.assertTrue(test is 1)
Parag Nemade 8a7942
         test = 0
Parag Nemade 8a7942
         for tup in normal:
Parag Nemade 8a7942
             if tup[1]==100 or tup[1]==0:
Parag Nemade 8a7942
                 test=1
Parag Nemade 8a7942
                 break
Parag Nemade 8a7942
-        self.failUnless(test is 1)
Parag Nemade 8a7942
+        self.assertTrue(test is 1)
Parag Nemade 8a7942
         test = 0
Parag Nemade 8a7942
         if len(normal) == len(bold) == len(italic):
Parag Nemade 8a7942
             test = 1
Parag Nemade 8a7942
-        self.failUnless(test is 1)
Parag Nemade 8a7942
+        self.assertTrue(test is 1)
Parag Nemade 8a7942
 
Parag Nemade 8a7942
     def testGlyphConsistency(self):
Parag Nemade 8a7942
         cm = GlyphConsistency()
Parag Nemade 8a7942
@@ -99,11 +99,11 @@ class Basictests(unittest.TestCase):
Parag Nemade 8a7942
         test3 = cm.glyph_round_consistency(testfont,(0x900,0x97f),50)
Parag Nemade 8a7942
 
Parag Nemade 8a7942
         test = (0 <= test1[0][1] <= 10)
Parag Nemade 8a7942
-        self.failUnless(test)
Parag Nemade 8a7942
+        self.assertTrue(test)
Parag Nemade 8a7942
         test2 = (0 <= test2 <= 10)
Parag Nemade 8a7942
-        self.failUnless(test2)
Parag Nemade 8a7942
+        self.assertTrue(test2)
Parag Nemade 8a7942
         test3 = (0 <= test3 <= 10)
Parag Nemade 8a7942
-        self.failUnless(test3)
Parag Nemade 8a7942
+        self.assertTrue(test3)
Parag Nemade 8a7942
 
Parag Nemade 8a7942
 """
Parag Nemade 8a7942
 unittests for DocCompare not required.
Parag Nemade 8a7942
diff --git a/pycontrib/collab/web-test-collab.py b/pycontrib/collab/web-test-collab.py
Parag Nemade 8a7942
index 47b763f..b19f930 100755
Parag Nemade 8a7942
--- a/pycontrib/collab/web-test-collab.py
Parag Nemade 8a7942
+++ b/pycontrib/collab/web-test-collab.py
Parag Nemade 8a7942
@@ -68,7 +68,7 @@ def OnCollabUpdate(f):
Parag Nemade 8a7942
             "end": "null" # this is simply so we dont have to manage keeping the last item with no terminating ,
Parag Nemade 8a7942
             }, 
Parag Nemade 8a7942
             sort_keys=True, indent=4, separators=(',', ': '))
Parag Nemade 8a7942
-    print js
Parag Nemade 8a7942
+    print(js)
Parag Nemade 8a7942
     fi = open(fontJsonOnDisk, 'w')
Parag Nemade 8a7942
     fi.write(js)
Parag Nemade 8a7942
 
Parag Nemade 8a7942
diff --git a/pycontrib/even.py b/pycontrib/even.py
Parag Nemade 8a7942
index 96f9128..4f30fcb 100755
Parag Nemade 8a7942
--- a/pycontrib/even.py
Parag Nemade 8a7942
+++ b/pycontrib/even.py
Parag Nemade 8a7942
@@ -1,4 +1,4 @@
Parag Nemade 8a7942
-#!/usr/bin/python
Parag Nemade 8a7942
+#!/usr/bin/python3
Parag Nemade 8a7942
 # -*- coding: utf-8 -*-
Parag Nemade 8a7942
 """
Parag Nemade 8a7942
 running even from the fontforge menu
Parag Nemade 8a7942
diff --git a/pycontrib/gdraw/__init__.py b/pycontrib/gdraw/__init__.py
Parag Nemade 8a7942
index d47976c..25bf981 100644
Parag Nemade 8a7942
--- a/pycontrib/gdraw/__init__.py
Parag Nemade 8a7942
+++ b/pycontrib/gdraw/__init__.py
Parag Nemade 8a7942
@@ -1,4 +1,4 @@
Parag Nemade 8a7942
-#!/usr/bin/python
Parag Nemade 8a7942
+#!/usr/bin/python3
Parag Nemade 8a7942
 # vim:ts=8:sw=4:expandtab:encoding=utf-8
Parag Nemade 8a7942
 '''
Parag Nemade 8a7942
 Copyright <hashao2@gmail.com> 2009
Parag Nemade 8a7942
diff --git a/pycontrib/gdraw/gdraw.py b/pycontrib/gdraw/gdraw.py
Parag Nemade 8a7942
index f2d5e50..3ed3abd 100755
Parag Nemade 8a7942
--- a/pycontrib/gdraw/gdraw.py
Parag Nemade 8a7942
+++ b/pycontrib/gdraw/gdraw.py
Parag Nemade 8a7942
@@ -1,4 +1,4 @@
Parag Nemade 8a7942
-#!/usr/bin/python
Parag Nemade 8a7942
+#!/usr/bin/python3
Parag Nemade 8a7942
 '''ctypes wrapper to Attach the GDraw event handler to the gtk main loop.
Parag Nemade 8a7942
 
Parag Nemade 8a7942
 Copyright <hashao2@gmail.com> 2009
Parag Nemade 8a7942
@@ -111,7 +111,7 @@ class Timer:
Parag Nemade 8a7942
 
Parag Nemade 8a7942
         return
Parag Nemade 8a7942
         def dodo(*args):
Parag Nemade 8a7942
-            print 'aaa'
Parag Nemade 8a7942
+            print('aaa')
Parag Nemade 8a7942
             return False
Parag Nemade 8a7942
         self.add(1000, dodo)
Parag Nemade 8a7942
 
Parag Nemade 8a7942
@@ -122,7 +122,7 @@ class Timer:
Parag Nemade 8a7942
 
Parag Nemade 8a7942
     def _event_handler(self, gw, event):
Parag Nemade 8a7942
         evt = event.contents
Parag Nemade 8a7942
-        print "_event_handler()"
Parag Nemade 8a7942
+        print("_event_handler()")
Parag Nemade 8a7942
         if evt.type == et_timer:
Parag Nemade 8a7942
             timer = evt.u.timer.timer
Parag Nemade 8a7942
             tkey = addressof(timer.contents)
Parag Nemade 8a7942
@@ -147,7 +147,7 @@ class Timer:
Parag Nemade 8a7942
         ci.func = CallBackFunc(func)
Parag Nemade 8a7942
         ci.data = data
Parag Nemade 8a7942
 
Parag Nemade 8a7942
-        print "timer.add timeout", timeout
Parag Nemade 8a7942
+        print("timer.add timeout", timeout)
Parag Nemade 8a7942
         frequency = 1 # Use return value of func() to decide repeat like gtk.
Parag Nemade 8a7942
         timer = GDrawRequestTimer(self.win, timeout, timeout, byref(ci))
Parag Nemade 8a7942
 
Parag Nemade 8a7942
@@ -190,7 +190,7 @@ class GtkRunner:
Parag Nemade 8a7942
 
Parag Nemade 8a7942
     def _do_main(self, *args):
Parag Nemade 8a7942
         '''The function called by the gdraw timeout handler.'''
Parag Nemade 8a7942
-        print "do_main"
Parag Nemade 8a7942
+        print("do_main")
Parag Nemade 8a7942
         while gtk.events_pending():
Parag Nemade 8a7942
             gtk.main_iteration(False)
Parag Nemade 8a7942
         return True
Parag Nemade 8a7942
@@ -207,15 +207,15 @@ class GtkRunner:
Parag Nemade 8a7942
             self.gtk_timer = None
Parag Nemade 8a7942
 
Parag Nemade 8a7942
     def OnDestroyWindow(self, widget, fd ):
Parag Nemade 8a7942
-        print fd
Parag Nemade 8a7942
+        print(fd)
Parag Nemade 8a7942
         fontforge.removeGtkWindowToMainEventLoopByFD( fd )
Parag Nemade 8a7942
         self.stop()
Parag Nemade 8a7942
         return True
Parag Nemade 8a7942
 
Parag Nemade 8a7942
     def sniffwindow(self,w):
Parag Nemade 8a7942
         '''sniff key presses for a gtk window'''
Parag Nemade 8a7942
-        print "sniffwindow w", w
Parag Nemade 8a7942
-        print "sniff active font:", fontforge.activeFont()
Parag Nemade 8a7942
+        print("sniffwindow w", w)
Parag Nemade 8a7942
+        print("sniff active font:", fontforge.activeFont())
Parag Nemade 8a7942
         w.connect("key-release-event", self._do_main)
Parag Nemade 8a7942
         fontforge.addGtkWindowToMainEventLoop(w.window.xid)
Parag Nemade 8a7942
         fd = fontforge.getGtkWindowMainEventLoopFD(w.window.xid)
Parag Nemade 8a7942
@@ -223,7 +223,7 @@ class GtkRunner:
Parag Nemade 8a7942
 
Parag Nemade 8a7942
     def sniffwindowid(self,xid):
Parag Nemade 8a7942
         '''sniff key presses for a gtk window'''
Parag Nemade 8a7942
-        print "sniffwindowid xid", xid
Parag Nemade 8a7942
+        print("sniffwindowid xid", xid)
Parag Nemade 8a7942
         #w.connect("key-release-event", self._do_main)
Parag Nemade 8a7942
 
Parag Nemade 8a7942
     def start(self, timeout=GTIMEOUT):
Parag Nemade 8a7942
diff --git a/pycontrib/graphicore.py b/pycontrib/graphicore.py
Parag Nemade 8a7942
index f95e488..a986327 100755
Parag Nemade 8a7942
--- a/pycontrib/graphicore.py
Parag Nemade 8a7942
+++ b/pycontrib/graphicore.py
Parag Nemade 8a7942
@@ -1,4 +1,4 @@
Parag Nemade 8a7942
-#!/usr/bin/python
Parag Nemade 8a7942
+#!/usr/bin/python3
Parag Nemade 8a7942
 # -*- coding: utf-8 -*-
Parag Nemade 8a7942
 """
Parag Nemade 8a7942
 running the fontforge scripts in the graphicore folder on fontforge startup
Parag Nemade 8a7942
diff --git a/pycontrib/graphicore/ipython_view.py b/pycontrib/graphicore/ipython_view.py
Parag Nemade 8a7942
index f39eedb..2b77395 100644
Parag Nemade 8a7942
--- a/pycontrib/graphicore/ipython_view.py
Parag Nemade 8a7942
+++ b/pycontrib/graphicore/ipython_view.py
Parag Nemade 8a7942
@@ -1,4 +1,4 @@
Parag Nemade 8a7942
-#!/usr/bin/python
Parag Nemade 8a7942
+#!/usr/bin/python3
Parag Nemade 8a7942
 '''
Parag Nemade 8a7942
 Provides IPython console widget.
Parag Nemade 8a7942
 
Parag Nemade 8a7942
@@ -17,10 +17,11 @@ import re
Parag Nemade 8a7942
 import sys
Parag Nemade 8a7942
 import os
Parag Nemade 8a7942
 import pango
Parag Nemade 8a7942
-from StringIO import StringIO
Parag Nemade 8a7942
-import thread
Parag Nemade 8a7942
+from io import StringIO
Parag Nemade 8a7942
+import _thread
Parag Nemade 8a7942
 
Parag Nemade 8a7942
 import IPython
Parag Nemade 8a7942
+from functools import reduce
Parag Nemade 8a7942
 
Parag Nemade 8a7942
 class IterableIPShell:
Parag Nemade 8a7942
   '''
Parag Nemade 8a7942
@@ -118,7 +119,7 @@ class IterableIPShell:
Parag Nemade 8a7942
     '''
Parag Nemade 8a7942
     This function updates namespace with sys.modules
Parag Nemade 8a7942
     '''
Parag Nemade 8a7942
-    for k,v in sys.modules.items():
Parag Nemade 8a7942
+    for k,v in list(sys.modules.items()):
Parag Nemade 8a7942
       if not '.' in k:
Parag Nemade 8a7942
         self.IP.user_ns.update({k:v})
Parag Nemade 8a7942
 
Parag Nemade 8a7942
@@ -271,11 +272,11 @@ class IterableIPShell:
Parag Nemade 8a7942
     @type header: string
Parag Nemade 8a7942
     '''
Parag Nemade 8a7942
     stat = 0
Parag Nemade 8a7942
-    if verbose or debug: print header+cmd
Parag Nemade 8a7942
+    if verbose or debug: print(header+cmd)
Parag Nemade 8a7942
     # flush stdout so we don't mangle python's buffering
Parag Nemade 8a7942
     if not debug:
Parag Nemade 8a7942
       input, output = os.popen4(cmd)
Parag Nemade 8a7942
-      print output.read()
Parag Nemade 8a7942
+      print(output.read())
Parag Nemade 8a7942
       output.close()
Parag Nemade 8a7942
       input.close()
Parag Nemade 8a7942
 
Parag Nemade 8a7942
diff --git a/pycontrib/graphicore/shell.py b/pycontrib/graphicore/shell.py
Parag Nemade 8a7942
index 5d102f7..2728ae2 100755
Parag Nemade 8a7942
--- a/pycontrib/graphicore/shell.py
Parag Nemade 8a7942
+++ b/pycontrib/graphicore/shell.py
Parag Nemade 8a7942
@@ -1,4 +1,4 @@
Parag Nemade 8a7942
-#!/usr/bin/python
Parag Nemade 8a7942
+#!/usr/bin/python3
Parag Nemade 8a7942
 # -*- coding: utf-8 -*-
Parag Nemade 8a7942
 """
Parag Nemade 8a7942
 FontForge Interactive Python Shell
Parag Nemade 8a7942
diff --git a/pycontrib/svg2sfd.py b/pycontrib/svg2sfd.py
Parag Nemade 8a7942
index e1fc0ac..e23cb15 100644
Parag Nemade 8a7942
--- a/pycontrib/svg2sfd.py
Parag Nemade 8a7942
+++ b/pycontrib/svg2sfd.py
Parag Nemade 8a7942
@@ -1,4 +1,4 @@
Parag Nemade 8a7942
-#!/usr/bin/python
Parag Nemade 8a7942
+#!/usr/bin/python3
Parag Nemade 8a7942
 #
Parag Nemade 8a7942
 # Copyright 2013 Google Inc. All rights reserved.
Parag Nemade 8a7942
 # 
Parag Nemade 8a7942
@@ -49,7 +49,7 @@ def print_one_cmd(cmd, args):
Parag Nemade 8a7942
       result.append('%f' % (scale * args[i]))
Parag Nemade 8a7942
   result.append(cmd)
Parag Nemade 8a7942
   result.append('0')  # TODO: should mark corner points
Parag Nemade 8a7942
-  print ' '.join(result)
Parag Nemade 8a7942
+  print(' '.join(result))
Parag Nemade 8a7942
 
Parag Nemade 8a7942
 def apply_rel_xy(xy, args):
Parag Nemade 8a7942
   x0, y0 = xy
Parag Nemade 8a7942
@@ -75,7 +75,7 @@ def path_to_sfd(path):
Parag Nemade 8a7942
     for i in range(num_args_cmd(cmd)):
Parag Nemade 8a7942
       m = fre.match(path)
Parag Nemade 8a7942
       if m is None:
Parag Nemade 8a7942
-        print 'no float match:', path
Parag Nemade 8a7942
+        print('no float match:', path)
Parag Nemade 8a7942
       args.append(float(m.group(1)))
Parag Nemade 8a7942
       path = path[m.end():]
Parag Nemade 8a7942
     #print cmd, args
Parag Nemade 8a7942
@@ -128,13 +128,13 @@ def conv_svg(fn, char, glyphnum = None):
Parag Nemade 8a7942
   if glyphnum == None:
Parag Nemade 8a7942
     glyphnum = lastglyphnum + 1
Parag Nemade 8a7942
   lastglyphnum = glyphnum
Parag Nemade 8a7942
-  print 'StartChar:', os.path.basename(fn)[:-4]
Parag Nemade 8a7942
-  print 'Encoding: %d %d %d' % (char, glyphnum, char)
Parag Nemade 8a7942
-  print 'Width: %d' % (21 * 40)
Parag Nemade 8a7942
-  print 'Flags: W'
Parag Nemade 8a7942
-  print 'LayerCount: 2'
Parag Nemade 8a7942
-  print 'Fore'
Parag Nemade 8a7942
-  print 'SplineSet'
Parag Nemade 8a7942
+  print('StartChar:', os.path.basename(fn)[:-4])
Parag Nemade 8a7942
+  print('Encoding: %d %d %d' % (char, glyphnum, char))
Parag Nemade 8a7942
+  print('Width: %d' % (21 * 40))
Parag Nemade 8a7942
+  print('Flags: W')
Parag Nemade 8a7942
+  print('LayerCount: 2')
Parag Nemade 8a7942
+  print('Fore')
Parag Nemade 8a7942
+  print('SplineSet')
Parag Nemade 8a7942
   doc = xml.dom.minidom.parse(fn)
Parag Nemade 8a7942
   # TODO: reverse paths if fill color is white-ish (this is more code,
Parag Nemade 8a7942
   # and in the meantime, we'll rely on correct path direction in FF)
Parag Nemade 8a7942
@@ -147,16 +147,16 @@ def conv_svg(fn, char, glyphnum = None):
Parag Nemade 8a7942
     cy = float(circle.getAttribute('cy'))
Parag Nemade 8a7942
     r = float(circle.getAttribute('r'))
Parag Nemade 8a7942
     circle_to_sfd(cx, cy, r)
Parag Nemade 8a7942
-  print 'EndSplineSet'
Parag Nemade 8a7942
-  print 'EndChar'
Parag Nemade 8a7942
+  print('EndSplineSet')
Parag Nemade 8a7942
+  print('EndChar')
Parag Nemade 8a7942
 
Parag Nemade 8a7942
 def print_header():
Parag Nemade 8a7942
   global header_printed
Parag Nemade 8a7942
-  print '''SplineFontDB: 3.0
Parag Nemade 8a7942
+  print('''SplineFontDB: 3.0
Parag Nemade 8a7942
 FontName: %s
Parag Nemade 8a7942
 FullName: %s
Parag Nemade 8a7942
-FamilyName: %s''' % (font_name, font_name, font_name)
Parag Nemade 8a7942
-  print '''Weight: Medium
Parag Nemade 8a7942
+FamilyName: %s''' % (font_name, font_name, font_name))
Parag Nemade 8a7942
+  print('''Weight: Medium
Parag Nemade 8a7942
 Copyright: Copyright (C) 2011 Google Inc.
Parag Nemade 8a7942
 Version: 001.000
Parag Nemade 8a7942
 UnderlinePosition: -120
Parag Nemade 8a7942
@@ -180,12 +180,12 @@ HheadAOffset: 0
Parag Nemade 8a7942
 HheadDescent: 200
Parag Nemade 8a7942
 HheadDOffset: 0
Parag Nemade 8a7942
 BeginChars: 57600 57600
Parag Nemade 8a7942
-'''
Parag Nemade 8a7942
+''')
Parag Nemade 8a7942
   header_printed = True
Parag Nemade 8a7942
 
Parag Nemade 8a7942
 def print_footer():
Parag Nemade 8a7942
-  print '''EndChars
Parag Nemade 8a7942
-EndSplineFont'''
Parag Nemade 8a7942
+  print('''EndChars
Parag Nemade 8a7942
+EndSplineFont''')
Parag Nemade 8a7942
 
Parag Nemade 8a7942
 def parse_int(x):
Parag Nemade 8a7942
   if x.startswith('0x'):
Parag Nemade 8a7942
@@ -197,7 +197,7 @@ def run_file(fn):
Parag Nemade 8a7942
   global char_num
Parag Nemade 8a7942
   global font_name
Parag Nemade 8a7942
   directory = ''
Parag Nemade 8a7942
-  for l in file(fn).xreadlines():
Parag Nemade 8a7942
+  for l in file(fn):
Parag Nemade 8a7942
     if l.startswith('#'):
Parag Nemade 8a7942
       continue
Parag Nemade 8a7942
     s = l.strip().split()
Parag Nemade 8a7942
diff --git a/pycontrib/webcollab.py b/pycontrib/webcollab.py
Parag Nemade 8a7942
index 9ee0f17..f96828c 100755
Parag Nemade 8a7942
--- a/pycontrib/webcollab.py
Parag Nemade 8a7942
+++ b/pycontrib/webcollab.py
Parag Nemade 8a7942
@@ -1,4 +1,4 @@
Parag Nemade 8a7942
-#!/usr/bin/python
Parag Nemade 8a7942
+#!/usr/bin/python3
Parag Nemade 8a7942
 # -*- coding: utf-8 -*-
Parag Nemade 8a7942
 """
Parag Nemade 8a7942
 running web collab server hooks
Parag Nemade 8a7942
-- 
Parag Nemade 8a7942
2.7.3
Parag Nemade 8a7942