Blame SOURCES/Add-python3-support.patch

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