mirror of https://github.com/KLayout/klayout.git
Merge branch 'macos-build' of https://github.com/Kazzz-S/klayout into macos-build
This commit is contained in:
commit
823a607cf6
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>NOTE</key>
|
||||||
|
<string>This file was originally generated by Qt/QMake.</string>
|
||||||
|
<key>CFBundleGetInfoString</key>
|
||||||
|
<string>Created by Qt/QMake</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>${EXECUTABLE}</string>
|
||||||
|
<key>CFBundleIconFile</key>
|
||||||
|
<string>${ICONFILE}</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>de.klayout</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>${BUNDLENAME}</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>APPL</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>${VERSION}</string>
|
||||||
|
<key>CFBundleSignature</key>
|
||||||
|
<string>????</string>
|
||||||
|
<key>NSPrincipalClass</key>
|
||||||
|
<string>NSApplication</string>
|
||||||
|
<key>NSSupportsAutomaticGraphicsSwitching</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#-------------------------------------------------------------------------------------
|
||||||
|
# File: KLayoutEditor.sh
|
||||||
|
#
|
||||||
|
# Descriptions:
|
||||||
|
# This is to invoke "klayout" distributed as a binary package for Mac
|
||||||
|
# in "editor" mode.
|
||||||
|
#
|
||||||
|
# You may specify style and other options as you like by setting
|
||||||
|
# "opt_style" and "opt_others" variable in this script.
|
||||||
|
#-------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#---------------------------------------------------------
|
||||||
|
# With "-n" option, multiple instances can be invoked
|
||||||
|
#---------------------------------------------------------
|
||||||
|
myKLayout="open -n -a /Applications/klayout.app --args "
|
||||||
|
|
||||||
|
#===================================================
|
||||||
|
# Pass command line parameters to klayout
|
||||||
|
# vvvvvvvvvv You may edit the block below vvvvvvvvvv
|
||||||
|
opt_mode="-e"
|
||||||
|
opt_style="-style=cleanlooks"
|
||||||
|
opt_others=""
|
||||||
|
# ^^^^^^^^^^ You may edit the block above ^^^^^^^^^^
|
||||||
|
#===================================================
|
||||||
|
options="$opt_mode $opt_style $opt_others"
|
||||||
|
targetfiles=$@
|
||||||
|
|
||||||
|
echo "### Starting KLayout in Editor mode..."
|
||||||
|
$myKLayout $options $targetfiles &
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
#-------------------
|
||||||
|
# End of file
|
||||||
|
#-------------------
|
||||||
Binary file not shown.
|
|
@ -0,0 +1,36 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#-------------------------------------------------------------------------------------
|
||||||
|
# File: KLayoutViewer.sh
|
||||||
|
#
|
||||||
|
# Descriptions:
|
||||||
|
# This is to invoke "klayout" distributed as a binary package for Mac
|
||||||
|
# in "viewer" mode.
|
||||||
|
#
|
||||||
|
# You may specify style and other options as you like by setting
|
||||||
|
# "opt_style" and "opt_others" variable in this script.
|
||||||
|
#-------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#---------------------------------------------------------
|
||||||
|
# With "-n" option, multiple instances can be invoked
|
||||||
|
#---------------------------------------------------------
|
||||||
|
myKLayout="open -n -a /Applications/klayout.app --args "
|
||||||
|
|
||||||
|
#===================================================
|
||||||
|
# Pass command line parameters to klayout
|
||||||
|
# vvvvvvvvvv You may edit the block below vvvvvvvvvv
|
||||||
|
opt_mode="-ne"
|
||||||
|
opt_style="-style=motif"
|
||||||
|
opt_others=""
|
||||||
|
# ^^^^^^^^^^ You may edit the block above ^^^^^^^^^^
|
||||||
|
#===================================================
|
||||||
|
options="$opt_mode $opt_style $opt_others"
|
||||||
|
targetfiles=$@
|
||||||
|
|
||||||
|
echo "### Starting KLayout in Viewer mode..."
|
||||||
|
$myKLayout $options $targetfiles &
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
#-------------------
|
||||||
|
# End of file
|
||||||
|
#-------------------
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -40,6 +40,7 @@ def SetGlobals():
|
||||||
global DebugMode # True if debug mode build
|
global DebugMode # True if debug mode build
|
||||||
global CheckComOnly # True if only for checking the command line parameters to "build.sh"
|
global CheckComOnly # True if only for checking the command line parameters to "build.sh"
|
||||||
global Deployment # True if deploying the binaries for a package
|
global Deployment # True if deploying the binaries for a package
|
||||||
|
global Version # KLayout's version
|
||||||
# auxiliary variables on platform
|
# auxiliary variables on platform
|
||||||
global System # 6-tuple from platform.uname()
|
global System # 6-tuple from platform.uname()
|
||||||
global Node # - do -
|
global Node # - do -
|
||||||
|
|
@ -130,6 +131,7 @@ def SetGlobals():
|
||||||
DebugMode = False
|
DebugMode = False
|
||||||
CheckComOnly = False
|
CheckComOnly = False
|
||||||
Deployment = False
|
Deployment = False
|
||||||
|
Version = GetKLayoutVersionFrom( "./version.sh" )
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
## To get command line parameters
|
## To get command line parameters
|
||||||
|
|
@ -413,7 +415,7 @@ def RunMainBuildBash():
|
||||||
# [3] Invoke the main Bash script
|
# [3] Invoke the main Bash script
|
||||||
#-----------------------------------------------------
|
#-----------------------------------------------------
|
||||||
if Deployment:
|
if Deployment:
|
||||||
return(0)
|
return 0
|
||||||
else:
|
else:
|
||||||
myscript = "build4mac.py"
|
myscript = "build4mac.py"
|
||||||
if subprocess.call( command, shell=True ) != 0:
|
if subprocess.call( command, shell=True ) != 0:
|
||||||
|
|
@ -422,14 +424,14 @@ def RunMainBuildBash():
|
||||||
print( "!!! <%s>: failed to build KLayout" % myscript, file=sys.stderr )
|
print( "!!! <%s>: failed to build KLayout" % myscript, file=sys.stderr )
|
||||||
print( "-------------------------------------------------------------" )
|
print( "-------------------------------------------------------------" )
|
||||||
print("")
|
print("")
|
||||||
return(1)
|
return 1
|
||||||
else:
|
else:
|
||||||
print("")
|
print("")
|
||||||
print( "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" )
|
print( "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" )
|
||||||
print( "### <%s>: successfully built KLayout" % myscript, file=sys.stderr )
|
print( "### <%s>: successfully built KLayout" % myscript, file=sys.stderr )
|
||||||
print( "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" )
|
print( "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" )
|
||||||
print("")
|
print("")
|
||||||
return(0)
|
return 0
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
## To deploy built binaries and libraries on which those binaries depend
|
## To deploy built binaries and libraries on which those binaries depend
|
||||||
|
|
@ -451,25 +453,26 @@ def DeployBinariesForBundle():
|
||||||
global AbsMacBinDir
|
global AbsMacBinDir
|
||||||
global AbsMacBuildDir
|
global AbsMacBuildDir
|
||||||
global AbsMacBuildLog
|
global AbsMacBuildLog
|
||||||
|
global Version
|
||||||
|
|
||||||
print("")
|
print("")
|
||||||
print( "##### Start deploying libraries and executables #####" )
|
print( "##### Started deploying libraries and executables for <klayout.app> #####" )
|
||||||
print( " [1] Checking the status of working directory ..." )
|
print( " [1] Checking the status of working directory ..." )
|
||||||
#-------------------------------------------------------------
|
#-------------------------------------------------------------
|
||||||
# [1] Check the status of working directory
|
# [1] Check the status of working directory
|
||||||
#-------------------------------------------------------------
|
#-------------------------------------------------------------
|
||||||
os.chdir(ProjectDir)
|
os.chdir(ProjectDir)
|
||||||
if not Deployment:
|
if not Deployment:
|
||||||
return(1)
|
return 1
|
||||||
if not os.path.isfile(MacBuildLog):
|
if not os.path.isfile(MacBuildLog):
|
||||||
print( "!!! Build log file <%s> does not present !!!" % MacBuildLog, file=sys.stderr )
|
print( "!!! Build log file <%s> does not present !!!" % MacBuildLog, file=sys.stderr )
|
||||||
return(1)
|
return 1
|
||||||
if not os.path.isdir(MacBuildDir):
|
if not os.path.isdir(MacBuildDir):
|
||||||
print( "!!! Build directory <%s> does not present !!!" % MacBuildDir, file=sys.stderr )
|
print( "!!! Build directory <%s> does not present !!!" % MacBuildDir, file=sys.stderr )
|
||||||
return(1)
|
return 1
|
||||||
if not os.path.isdir(MacBinDir):
|
if not os.path.isdir(MacBinDir):
|
||||||
print( "!!! Binary directory <%s> does not present !!!" % MacBinDir, file=sys.stderr )
|
print( "!!! Binary directory <%s> does not present !!!" % MacBinDir, file=sys.stderr )
|
||||||
return(1)
|
return 1
|
||||||
|
|
||||||
|
|
||||||
print( " [2] Creating a new empty directory <%s> for deployment ..." % MacPkgDir )
|
print( " [2] Creating a new empty directory <%s> for deployment ..." % MacPkgDir )
|
||||||
|
|
@ -583,7 +586,7 @@ def DeployBinariesForBundle():
|
||||||
if not ret == 0:
|
if not ret == 0:
|
||||||
msg = "!!! Failed to set and change to new identification names !!!"
|
msg = "!!! Failed to set and change to new identification names !!!"
|
||||||
print(msg)
|
print(msg)
|
||||||
return(1)
|
return 1
|
||||||
|
|
||||||
|
|
||||||
print( " [6] Copying built executables and resource files ..." )
|
print( " [6] Copying built executables and resource files ..." )
|
||||||
|
|
@ -594,21 +597,26 @@ def DeployBinariesForBundle():
|
||||||
os.chdir(ProjectDir)
|
os.chdir(ProjectDir)
|
||||||
sourceDir0 = "%s/klayout.app/Contents" % MacBinDir
|
sourceDir0 = "%s/klayout.app/Contents" % MacBinDir
|
||||||
sourceDir1 = sourceDir0 + "/MacOS"
|
sourceDir1 = sourceDir0 + "/MacOS"
|
||||||
sourceDir2 = "%s/etc" % ProjectDir
|
sourceDir2 = "%s/macbuild/Resources" % ProjectDir
|
||||||
sourceDir3 = "%s/src/klayout_main" % ProjectDir
|
sourceDir3 = "%s" % MacBinDir
|
||||||
sourceDir4 = "%s" % MacBinDir
|
|
||||||
|
|
||||||
shutil.copy2( sourceDir0 + "/Info.plist", targetDir0 )
|
tmpfileM = ProjectDir + "/macbuild/Resources/Info.plist.template"
|
||||||
shutil.copy2( sourceDir1 + "/klayout", targetDirM )
|
keydicM = { 'exe': 'klayout', 'icon': 'klayout.icns', 'bname': 'klayout', 'ver': Version }
|
||||||
shutil.copy2( sourceDir2 + "/logo.png", targetDirR )
|
plistM = GenerateInfoPlist( keydicM, tmpfileM )
|
||||||
shutil.copy2( sourceDir3 + "/logo.ico", targetDirR )
|
file = open( targetDir0 + "/Info.plist", "w" )
|
||||||
|
file.write(plistM)
|
||||||
|
file.close()
|
||||||
|
|
||||||
os.chmod( targetDir0 + "/Info.plist", 0644 )
|
shutil.copy2( sourceDir0 + "/PkgInfo", targetDir0 ) # this file is not mandatory
|
||||||
os.chmod( targetDirM + "/klayout", 0755 )
|
shutil.copy2( sourceDir1 + "/klayout", targetDirM )
|
||||||
os.chmod( targetDirR + "/logo.png", 0644 )
|
shutil.copy2( sourceDir2 + "/klayout.icns", targetDirR )
|
||||||
os.chmod( targetDirR + "/logo.ico", 0644 )
|
|
||||||
|
|
||||||
buddies = glob.glob( sourceDir4 + "/strm*" )
|
os.chmod( targetDir0 + "/PkgInfo", 0644 )
|
||||||
|
os.chmod( targetDir0 + "/Info.plist", 0644 )
|
||||||
|
os.chmod( targetDirM + "/klayout", 0755 )
|
||||||
|
os.chmod( targetDirR + "/klayout.icns", 0644 )
|
||||||
|
|
||||||
|
buddies = glob.glob( sourceDir3 + "/strm*" )
|
||||||
for item in buddies:
|
for item in buddies:
|
||||||
shutil.copy2( item, targetDirB )
|
shutil.copy2( item, targetDirB )
|
||||||
buddy = os.path.basename(item)
|
buddy = os.path.basename(item)
|
||||||
|
|
@ -628,7 +636,7 @@ def DeployBinariesForBundle():
|
||||||
os.chdir(ProjectDir)
|
os.chdir(ProjectDir)
|
||||||
msg = "!!! Failed to set/change library identification name for <%s> !!!"
|
msg = "!!! Failed to set/change library identification name for <%s> !!!"
|
||||||
print( msg % klayoutexec, file=sys.stderr )
|
print( msg % klayoutexec, file=sys.stderr )
|
||||||
return(1)
|
return 1
|
||||||
|
|
||||||
buddies = glob.glob( "klayout.app/Contents/Buddy/strm*" )
|
buddies = glob.glob( "klayout.app/Contents/Buddy/strm*" )
|
||||||
macdepQtOpt = ""
|
macdepQtOpt = ""
|
||||||
|
|
@ -639,7 +647,7 @@ def DeployBinariesForBundle():
|
||||||
os.chdir(ProjectDir)
|
os.chdir(ProjectDir)
|
||||||
msg = "!!! Failed to set/change library identification name for <%s> !!!"
|
msg = "!!! Failed to set/change library identification name for <%s> !!!"
|
||||||
print( msg % buddy, file=sys.stderr )
|
print( msg % buddy, file=sys.stderr )
|
||||||
return(1)
|
return 1
|
||||||
|
|
||||||
|
|
||||||
print( " [8] Finally, deploying Qt's Frameworks ..." )
|
print( " [8] Finally, deploying Qt's Frameworks ..." )
|
||||||
|
|
@ -663,13 +671,116 @@ def DeployBinariesForBundle():
|
||||||
print( msg, file=sys.stderr )
|
print( msg, file=sys.stderr )
|
||||||
print("")
|
print("")
|
||||||
os.chdir(ProjectDir)
|
os.chdir(ProjectDir)
|
||||||
return(1)
|
return 1
|
||||||
else:
|
else:
|
||||||
msg = "### Deployed applications on OS X ###"
|
print( "##### Finished deploying libraries and executables for <klayout.app> #####" )
|
||||||
print( msg, file=sys.stderr )
|
|
||||||
print("")
|
print("")
|
||||||
os.chdir(ProjectDir)
|
os.chdir(ProjectDir)
|
||||||
return(0)
|
return 0
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
## To deploy script bundles that invoke the main bundle (klayout.app) in
|
||||||
|
# editor mode or viewer mode
|
||||||
|
#
|
||||||
|
# @return 0 on success; non-zero on failure
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
def DeployScriptBundles():
|
||||||
|
global ProjectDir
|
||||||
|
global MacPkgDir
|
||||||
|
global AbsMacPkgDir
|
||||||
|
|
||||||
|
print("")
|
||||||
|
print( "##### Started deploying files for <KLayoutEditor.app> and <KLayoutViewer.app> #####" )
|
||||||
|
print( " [1] Checking the status of working directory ..." )
|
||||||
|
#-------------------------------------------------------------
|
||||||
|
# [1] Check the status of working directory
|
||||||
|
#-------------------------------------------------------------
|
||||||
|
os.chdir(ProjectDir)
|
||||||
|
if not os.path.isdir(MacPkgDir):
|
||||||
|
print( "!!! Package directory <%s> does not present !!!" % MacPkgDir, file=sys.stderr )
|
||||||
|
return 1
|
||||||
|
|
||||||
|
|
||||||
|
print( " [2] Creating a new empty directory <%s> for deployment ..." % (MacPkgDir + "/klayout.scripts") )
|
||||||
|
#-------------------------------------------------------------
|
||||||
|
# [2] Create a new empty directory for deploying binaries
|
||||||
|
#-------------------------------------------------------------
|
||||||
|
os.chdir(MacPkgDir)
|
||||||
|
scriptDir = "klayout.scripts"
|
||||||
|
if os.path.isfile(scriptDir):
|
||||||
|
os.remove(scriptDir)
|
||||||
|
if os.path.isdir(scriptDir):
|
||||||
|
shutil.rmtree(scriptDir)
|
||||||
|
os.mkdir(scriptDir)
|
||||||
|
|
||||||
|
|
||||||
|
print( " [3] Creating the standard directory structure for the script bundles ..." )
|
||||||
|
#-------------------------------------------------------------
|
||||||
|
# [3] Create the directory skeleton for the two script bundles.
|
||||||
|
#
|
||||||
|
# klayout.scripts/+
|
||||||
|
# +-- KLayoutEditor.app/+
|
||||||
|
# | +-- Contents/+
|
||||||
|
# | +-- Info.plist
|
||||||
|
# | +-- Resources/
|
||||||
|
# | +-- MacOS/+
|
||||||
|
# | +-- 'KLayoutEditor.sh'
|
||||||
|
# +-- KLayoutViewer.app/+
|
||||||
|
# +-- Contents/+
|
||||||
|
# +-- Info.plist
|
||||||
|
# +-- Resources/
|
||||||
|
# +-- MacOS/+
|
||||||
|
# +-- 'KLayoutViewer.sh'
|
||||||
|
#-------------------------------------------------------------
|
||||||
|
os.chdir(ProjectDir)
|
||||||
|
targetDir0E = "%s/%s/KLayoutEditor.app/Contents" % ( AbsMacPkgDir, scriptDir )
|
||||||
|
targetDir0V = "%s/%s/KLayoutViewer.app/Contents" % ( AbsMacPkgDir, scriptDir )
|
||||||
|
|
||||||
|
targetDirME = targetDir0E + "/MacOS"
|
||||||
|
targetDirMV = targetDir0V + "/MacOS"
|
||||||
|
targetDirRE = targetDir0E + "/Resources"
|
||||||
|
targetDirRV = targetDir0V + "/Resources"
|
||||||
|
|
||||||
|
os.makedirs(targetDirME)
|
||||||
|
os.makedirs(targetDirMV)
|
||||||
|
os.makedirs(targetDirRE)
|
||||||
|
os.makedirs(targetDirRV)
|
||||||
|
|
||||||
|
|
||||||
|
print( " [4] Copying script files and icon files ..." )
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# [4] Copy different script files icon files
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
os.chdir(ProjectDir)
|
||||||
|
resourceDir = "macbuild/Resources"
|
||||||
|
|
||||||
|
shutil.copy2( resourceDir + "/KLayoutEditor.sh", targetDirME )
|
||||||
|
shutil.copy2( resourceDir + "/KLayoutViewer.sh", targetDirMV )
|
||||||
|
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 )
|
||||||
|
|
||||||
|
tmpfileE = ProjectDir + "/macbuild/Resources/Info.plist.template"
|
||||||
|
keydicE = { 'exe': 'KLayoutEditor.sh', 'icon': 'klayout-red.icns', 'bname': 'klayout', 'ver': Version }
|
||||||
|
plistE = GenerateInfoPlist( keydicE, tmpfileE )
|
||||||
|
fileE = open( targetDir0E + "/Info.plist", "w" )
|
||||||
|
fileE.write(plistE)
|
||||||
|
fileE.close()
|
||||||
|
|
||||||
|
tmpfileV = ProjectDir + "/macbuild/Resources/Info.plist.template"
|
||||||
|
keydicV = { 'exe': 'KLayoutViewer.sh', 'icon': 'klayout-blue.icns', 'bname': 'klayout', 'ver': Version }
|
||||||
|
plistV = GenerateInfoPlist( keydicV, tmpfileV )
|
||||||
|
fileV = open( targetDir0V + "/Info.plist", "w" )
|
||||||
|
fileV.write(plistV)
|
||||||
|
fileV.close()
|
||||||
|
print( "##### Finished deploying files for <KLayoutEditor.app> and <KLayoutViewer.app> #####" )
|
||||||
|
print("")
|
||||||
|
os.chdir(ProjectDir)
|
||||||
|
return 0
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
## The main function
|
## The main function
|
||||||
|
|
@ -684,8 +795,12 @@ def main():
|
||||||
else:
|
else:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
ret = DeployBinariesForBundle()
|
ret1 = DeployBinariesForBundle()
|
||||||
sys.exit(ret)
|
ret2 = DeployScriptBundles()
|
||||||
|
if not (ret1 == 0 and ret2 == 0):
|
||||||
|
sys.exit(1)
|
||||||
|
else:
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
#===================================================================================
|
#===================================================================================
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,8 @@
|
||||||
from __future__ import print_function # to use print() of Python 3 in Python >= 2.7
|
from __future__ import print_function # to use print() of Python 3 in Python >= 2.7
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
|
import string
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
|
|
@ -88,7 +90,7 @@ def SetChangeIdentificationNameOfDyLib( libdic ):
|
||||||
if subprocess.call( command, shell=True ) != 0:
|
if subprocess.call( command, shell=True ) != 0:
|
||||||
msg = "!!! Failed to set the new identification name to <%s> !!!"
|
msg = "!!! Failed to set the new identification name to <%s> !!!"
|
||||||
print( msg % lib, file=sys.stderr )
|
print( msg % lib, file=sys.stderr )
|
||||||
return(1)
|
return 1
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
# [2] Make the library aware of the new identifications of all supporters
|
# [2] Make the library aware of the new identifications of all supporters
|
||||||
|
|
@ -101,9 +103,9 @@ def SetChangeIdentificationNameOfDyLib( libdic ):
|
||||||
if subprocess.call( command, shell=True ) != 0:
|
if subprocess.call( command, shell=True ) != 0:
|
||||||
msg = "!!! Failed to make the library aware of the new identification name <%s> of supporter <%s> !!!"
|
msg = "!!! Failed to make the library aware of the new identification name <%s> of supporter <%s> !!!"
|
||||||
print( msg % (nameNew, sup), file=sys.stderr )
|
print( msg % (nameNew, sup), file=sys.stderr )
|
||||||
return(1)
|
return 1
|
||||||
# for-lib
|
# for-lib
|
||||||
return(0)
|
return 0
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
## To set the identification names of KLayout's libraries to an executable
|
## To set the identification names of KLayout's libraries to an executable
|
||||||
|
|
@ -150,7 +152,7 @@ def SetChangeLibIdentificationName( executable, relativedir ):
|
||||||
if subprocess.call( command, shell=True ) != 0:
|
if subprocess.call( command, shell=True ) != 0:
|
||||||
msg = "!!! Failed to set the new identification name to <%s> !!!"
|
msg = "!!! Failed to set the new identification name to <%s> !!!"
|
||||||
print( msg % lib, file=sys.stderr )
|
print( msg % lib, file=sys.stderr )
|
||||||
return(1)
|
return 1
|
||||||
|
|
||||||
#-----------------------------------------------------------
|
#-----------------------------------------------------------
|
||||||
# [2] Make the application aware of the new identification
|
# [2] Make the application aware of the new identification
|
||||||
|
|
@ -161,9 +163,65 @@ def SetChangeLibIdentificationName( executable, relativedir ):
|
||||||
if subprocess.call( command, shell=True ) != 0:
|
if subprocess.call( command, shell=True ) != 0:
|
||||||
msg = "!!! Failed to make the application aware of the new identification name <%s> !!!"
|
msg = "!!! Failed to make the application aware of the new identification name <%s> !!!"
|
||||||
print( msg % nameNew, file=sys.stderr )
|
print( msg % nameNew, file=sys.stderr )
|
||||||
return(1)
|
return 1
|
||||||
# for-lib
|
# for-lib
|
||||||
return(0)
|
return 0
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
## To get KLayout's version from a file; most likely from 'version.sh'
|
||||||
|
#
|
||||||
|
# @param[in] verfile version file from which version is retrieved
|
||||||
|
#
|
||||||
|
# @return version string
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
def GetKLayoutVersionFrom( verfile='version.h' ):
|
||||||
|
version = "?.?.?"
|
||||||
|
try:
|
||||||
|
fd = open( verfile, "r" )
|
||||||
|
contents = fd.readlines()
|
||||||
|
fd.close()
|
||||||
|
except Exception as e:
|
||||||
|
return version
|
||||||
|
|
||||||
|
verReg = re.compile( u'(KLAYOUT_VERSION=\")([0-9A-Z_a-z\.]+)(\")' )
|
||||||
|
for line in contents:
|
||||||
|
m = verReg.match(line)
|
||||||
|
if m:
|
||||||
|
# print(m.group(0)) # KLAYOUT_VERSION="0.25"
|
||||||
|
# print(m.group(1)) # KLAYOUT_VERSION="
|
||||||
|
# print(m.group(2)) # 0.25
|
||||||
|
# print(m.group(3)) # "
|
||||||
|
version = m.group(2)
|
||||||
|
return version
|
||||||
|
return version
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
## To generate the contents of "Info.plist" file from a template
|
||||||
|
#
|
||||||
|
# @param[in] keydic dictionary of four key words ['exe', 'icon', 'bname', 'ver']
|
||||||
|
# @param[in] templfile template file ("macbuild/Resources/Info.plist.template")
|
||||||
|
#
|
||||||
|
# @return generated strings
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
def GenerateInfoPlist( keydic, templfile ):
|
||||||
|
val_exe = keydic['exe']
|
||||||
|
val_icon = keydic['icon']
|
||||||
|
val_bname = keydic['bname']
|
||||||
|
val_ver = keydic['ver']
|
||||||
|
|
||||||
|
try:
|
||||||
|
fd = open( templfile, "r" )
|
||||||
|
template = fd.read()
|
||||||
|
fd.close()
|
||||||
|
except Exception as e:
|
||||||
|
return "???"
|
||||||
|
|
||||||
|
t = string.Template(template)
|
||||||
|
s = t.substitute( EXECUTABLE = val_exe,
|
||||||
|
ICONFILE = val_icon,
|
||||||
|
BUNDLENAME = val_bname,
|
||||||
|
VERSION = val_ver)
|
||||||
|
return s
|
||||||
|
|
||||||
#----------------
|
#----------------
|
||||||
# End of File
|
# End of File
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue