Adding start-console.py script to klayout.app

This commit is contained in:
Thomas Ferreira de Lima 2018-03-19 17:18:24 -04:00
parent 6438d665fc
commit f23a4a7227
4 changed files with 20 additions and 12 deletions

View File

@ -0,0 +1,2 @@
#!/usr/bin/env bash
/Applications/klayout.app/Contents/MacOS/klayout -b -r /Applications/klayout.app/Contents/MacOS/start-console.py

View File

@ -0,0 +1,12 @@
#!/Applications/klayout.app/Contents/MacOS/klayout -b -r
import readline
import code
import sys
variables = globals().copy()
variables.update(locals())
shell = code.InteractiveConsole(variables)
cprt = 'Type "help", "copyright", "credits" or "license" for more information.'
banner = "Python %s on %s\n%s\n(%s)" % (sys.version, sys.platform,
cprt, "KLayout Python Console")
exit_msg = 'now exiting %s...' % "KLayout Python Console"
shell.interact(banner, exit_msg)

View File

@ -538,8 +538,8 @@ def DeployBinariesForBundle():
if not DeploymentF and not DeploymentP: if not DeploymentF and not DeploymentP:
return 1 return 1
if DeploymentF and NonOSStdLang: if DeploymentF and NonOSStdLang:
print( "WARNING!!! You chose <-y|--deploy> while using non-OS-standard script language.", file=sys.stderr ) print( " WARNING!!! You chose <-y|--deploy> while using non-OS-standard script language.", file=sys.stderr )
print( " Use <-Y|--DEPLOY> instead", file=sys.stderr ) print( " Consider using <-Y|--DEPLOY> instead", file=sys.stderr )
#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 )
@ -792,6 +792,10 @@ def DeployBinariesForBundle():
print( msg % command, file=sys.stderr ) print( msg % command, file=sys.stderr )
exit(1) exit(1)
shutil.copy2( sourceDir2 + "/start-console.py", targetDirM )
shutil.copy2( sourceDir2 + "/klayout_console", targetDirM )
os.chmod( targetDirM + "/klayout_console", 0o0755 )
print(" [2] Relinking dylib dependencies inside Python.framework") print(" [2] Relinking dylib dependencies inside Python.framework")
depdict = WalkFrameworkPaths(pythonFrameworkPath) depdict = WalkFrameworkPaths(pythonFrameworkPath)
appPythonFrameworkPath = '@executable_path/../Frameworks/Python.framework/' appPythonFrameworkPath = '@executable_path/../Frameworks/Python.framework/'

View File

@ -1,10 +0,0 @@
#!./klayout -b -r
import readline
import code
variables = globals().copy()
variables.update(locals())
shell = code.InteractiveConsole(variables)
self.write("Python %s on %s\n%s\n(%s)\n" %
(sys.version, sys.platform, cprt,
"KLayout Python Console"))
shell.interact(banner)