From bd1b2f2bbe499b9298e2c9ab730a9a1485ba266e Mon Sep 17 00:00:00 2001 From: Thomas Ferreira de Lima Date: Tue, 6 Mar 2018 01:01:16 -0500 Subject: [PATCH] running build script in python3 --- macbuild/build4mac.py | 25 +++++++++++++------------ macbuild/build4mac_env.py | 6 +++--- macbuild/build4mac_util.py | 2 +- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/macbuild/build4mac.py b/macbuild/build4mac.py index 9d5f292fc..e4f7098d4 100755 --- a/macbuild/build4mac.py +++ b/macbuild/build4mac.py @@ -65,7 +65,7 @@ def SetGlobals(): Usage += " : 'nil' = not to support the script language | \n" Usage += " : 'Sys' = using the OS standard script language | \n" Usage += " : Refer to 'macbuild/build4mac_env.py' for details | \n" - Usage += " [-q|--qt ] : type=['Qt4MacPorts', 'Qt5MacPorts'] | qt5macports \n" + Usage += " [-q|--qt ] : type=['Qt4MacPorts', 'Qt5MacPorts', 'Qt5Custom'] | qt5macports \n" Usage += " [-r|--ruby ] : type=['nil', 'Sys', 'Src24', 'MP24', 'B25'] | sys \n" Usage += " [-p|--python ] : type=['nil', 'Sys', 'Ana27', 'Ana36', 'MP36', 'B36'] | sys \n" Usage += " [-n|--noqtbinding] : don't create Qt bindings for ruby scripts | disabled \n" @@ -651,7 +651,7 @@ def DeployBinariesForBundle(): # e.g. [ 'libklayout_lay', '0', '25', '0', 'dylib' ] nameStyle3 = fullName[0] + "." + fullName[1] + ".dylib" shutil.copy2( item, nameStyle3 ) - os.chmod( nameStyle3, 0755 ) + os.chmod( nameStyle3, 0o0755 ) #------------------------------------------------------------------- # (B) Then get inter-library dependencies #------------------------------------------------------------------- @@ -699,16 +699,16 @@ def DeployBinariesForBundle(): shutil.copy2( sourceDir1 + "/klayout", targetDirM ) shutil.copy2( sourceDir2 + "/klayout.icns", targetDirR ) - os.chmod( targetDir0 + "/PkgInfo", 0644 ) - os.chmod( targetDir0 + "/Info.plist", 0644 ) - os.chmod( targetDirM + "/klayout", 0755 ) - os.chmod( targetDirR + "/klayout.icns", 0644 ) + os.chmod( targetDir0 + "/PkgInfo", 0o0644 ) + os.chmod( targetDir0 + "/Info.plist", 0o0644 ) + os.chmod( targetDirM + "/klayout", 0o0755 ) + os.chmod( targetDirR + "/klayout.icns", 0o0644 ) buddies = glob.glob( sourceDir3 + "/strm*" ) for item in buddies: shutil.copy2( item, targetDirB ) buddy = os.path.basename(item) - os.chmod( targetDirB + "/" + buddy, 0755 ) + os.chmod( targetDirB + "/" + buddy, 0o0755 ) print( " [7] Setting and changing the identification names of KLayout's libraries in each executable ..." ) @@ -727,7 +727,7 @@ def DeployBinariesForBundle(): return 1 buddies = glob.glob( "klayout.app/Contents/Buddy/strm*" ) - macdepQtOpt = "" + macdepQtOpt = "-executable=%s " % klayoutexec for buddy in buddies: macdepQtOpt += "-executable=%s " % buddy ret = SetChangeLibIdentificationName( buddy, "../Frameworks" ) @@ -759,6 +759,7 @@ def DeployBinariesForBundle(): os.chdir(ProjectDir) os.chdir(MacPkgDir) command = "%s %s %s" % ( deploytool, app_bundle, options ) + print(command) if subprocess.call( command, shell=True ) != 0: msg = "!!! Failed to deploy applications on OSX !!!" print( msg, file=sys.stderr ) @@ -860,10 +861,10 @@ def DeployScriptBundles(): shutil.copy2( resourceDir + "/klayout-red.icns", targetDirRE ) shutil.copy2( resourceDir + "/klayout-blue.icns", targetDirRV ) - os.chmod( targetDirME + "/KLayoutEditor.sh", 0755 ) - os.chmod( targetDirMV + "/KLayoutViewer.sh", 0755 ) - os.chmod( targetDirRE + "/klayout-red.icns", 0644 ) - os.chmod( targetDirRV + "/klayout-blue.icns", 0644 ) + os.chmod( targetDirME + "/KLayoutEditor.sh", 0o0755 ) + os.chmod( targetDirMV + "/KLayoutViewer.sh", 0o0755 ) + os.chmod( targetDirRE + "/klayout-red.icns", 0o0644 ) + os.chmod( targetDirRV + "/klayout-blue.icns", 0o0644 ) tmpfileE = ProjectDir + "/macbuild/Resources/Info.plist.template" keydicE = { 'exe': 'KLayoutEditor.sh', 'icon': 'klayout-red.icns', 'bname': 'klayout', 'ver': Version } diff --git a/macbuild/build4mac_env.py b/macbuild/build4mac_env.py index 2ab02ebe9..359d3f207 100755 --- a/macbuild/build4mac_env.py +++ b/macbuild/build4mac_env.py @@ -192,9 +192,9 @@ Python36MacPorts= { 'exe': '/opt/local/Library/Frameworks/Python.framework/Versi # Python 3.6 from Brew *+*+*+ EXPERIMENTAL *+*+*+ # [Key Type Name] = 'pybrew' -Python36Brew= { 'exe': '/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/bin/python3.6m' , - 'inc': '/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/include/python3.6m', - 'lib': '/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/libpython3.6m.dylib' +Python36Brew= { 'exe': '/usr/local/Cellar/python3/3.6.4_3/Frameworks/Python.framework/Versions/3.6/bin/python3.6m' , + 'inc': '/usr/local/Cellar/python3/3.6.4_3/Frameworks/Python.framework/Versions/3.6/include/python3.6m', + 'lib': '/usr/local/Cellar/python3/3.6.4_3/Frameworks/Python.framework/Versions/3.6/lib/libpython3.6m.dylib' } # Consolidated dictionary kit for Python diff --git a/macbuild/build4mac_util.py b/macbuild/build4mac_util.py index fe002014e..e8357aee2 100755 --- a/macbuild/build4mac_util.py +++ b/macbuild/build4mac_util.py @@ -143,7 +143,7 @@ def SetChangeLibIdentificationName( executable, relativedir ): otoolOut = os.popen( otoolCm ).read() exedepdic = DecomposeLibraryDependency( executable + ":\n" + otoolOut ) keys = exedepdic.keys() - deplibs = exedepdic[ keys[0] ] + deplibs = exedepdic[ list(keys)[0] ] for lib in deplibs: #-----------------------------------------------------------