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