]> www.ginac.de Git - ginac.git/blobdiff - scripts/yaptu.py
Convert shebangs to python3.
[ginac.git] / scripts / yaptu.py
index ddf18f5013eeb202c1907264da71a0ec266479f6..734d748a02dc6af8dec3e3a8ae4d6de6ec096a6e 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 """
 Yet Another Python Templating Utility, Version 1.2, by Alex Martelli.
 Distributed under PSF license (http://docs.python.org/license.html).
 """
 Yet Another Python Templating Utility, Version 1.2, by Alex Martelli.
 Distributed under PSF license (http://docs.python.org/license.html).
@@ -33,7 +33,7 @@ class copier:
         def repl(match, self=self):
             "return the eval of a found expression, for replacement"
             # uncomment for debug:
         def repl(match, self=self):
             "return the eval of a found expression, for replacement"
             # uncomment for debug:
-           # print '!!! replacing',match.group(1)
+            # print('!!! replacing',match.group(1))
             expr = self.preproc(match.group(1), 'eval')
             try: return str(eval(expr, self.globals, self.locals))
             except: return str(self.handle(expr))
             expr = self.preproc(match.group(1), 'eval')
             try: return str(eval(expr, self.globals, self.locals))
             except: return str(self.handle(expr))
@@ -65,8 +65,8 @@ class copier:
                 stat = self.preproc(stat, 'exec')
                 stat = '%s _cb(%s,%s)' % (stat,i+1,j)
                 # for debugging, uncomment...:
                 stat = self.preproc(stat, 'exec')
                 stat = '%s _cb(%s,%s)' % (stat,i+1,j)
                 # for debugging, uncomment...:
-               # print "-> Executing: {"+stat+"}"
-                exec stat in self.globals,self.locals
+                # print("-> Executing: {"+stat+"}")
+                exec(stat, self.globals, self.locals)
                 i=j+1
             else:       # normal line, just copy with substitution
                 self.ouf.write(self.regex.sub(repl,line))
                 i=j+1
             else:       # normal line, just copy with substitution
                 self.ouf.write(self.regex.sub(repl,line))