diff tools/msys2-install.py @ 5494:898c27394c57

Use python3 in scripts (bug #58689). * Makefile.in: native mingw, depend on python3, set PYTHON3 var * tools/msys2-install.py: update for python3 syntax * tools/pkg-install.py: update for python3 syntax
author John Donoghue <john.donoghue@ieee.org>
date Sat, 04 Jul 2020 12:14:29 -0400
parents 1cbfb3375099
children 602265d1c653
line wrap: on
line diff
--- a/tools/msys2-install.py	Thu Jul 23 12:29:32 2020 -0400
+++ b/tools/msys2-install.py	Sat Jul 04 12:14:29 2020 -0400
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
 
 import sys
 import os
@@ -156,7 +156,7 @@
   files=glob.glob(pkgpath + pkgname + "-" + "[r0-9].*")
   for f in files:
     if env.verbose:
-      print "uninstalling " + f
+      print ("uninstalling " + f)
     shutil.rmtree(f)
 
 def install_pkg(pkg, env):
@@ -168,7 +168,7 @@
     ## Check that the directory in prefix exist. If it doesn't: create it!
     tmpdir = tempfile.mkdtemp("-pkg","tmp", env.tmp)
     if env.verbose:
-      print "using tempdir ", tmpdir
+      print ("using tempdir ", tmpdir)
     os.chdir(tmpdir)
 
     # unpack dir
@@ -202,7 +202,7 @@
           fullpath = fullpath[tmplen:]
           filelist.append(fullpath)
           if env.verbose:
-            print "installing " + fullpath
+            print ("installing " + fullpath)
 
           # dele old file fo can copy new with perms (if ld file would allow write)
           if os.path.isfile(env.msysdir + "/" + fullpath):
@@ -211,7 +211,7 @@
           shutil.copy2(os.path.join(root, file), env.msysdir + "/" + fullpath)
 
     if env.verbose:
-      print "creating package files"
+      print ("creating package files")
 
     # create pkg files needed
     pkg_name_ver = pkginfo.get('pkgname', [''])[0] + "-" + pkginfo.get('pkgver',[''])[0]
@@ -225,7 +225,7 @@
 
   finally:
     if env.verbose:
-      print "cleaning up"
+      print ("cleaning up")
     os.chdir(currdir)
 
     if env.cleanup:
@@ -239,7 +239,7 @@
   files = []
  
   for a in args:
-    print a
+    print ("{}".format(a))
     c=a.split("=")
     key=c[0]
     if len(c) > 1:
@@ -275,7 +275,7 @@
   return status
 
 def show_usage():
-  print sys.argv[0], "[options] pkg1 [pkg2]"
+  print (sys.argv[0], "[options] pkg1 [pkg2]")
 
 if __name__ == "__main__":
   if len(sys.argv) > 1: