]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/scripts/CreateMacScripts.py
   1 #---------------------------------------------------------------------- 
   2 # Name:         CreateMacScripts.py 
   3 # Purpose:      Massages the scripts to be usable with MachoPython 
   8 # Copyright:    (c) 2002 by Total Control Software 
   9 # Licence:      wxWindows license 
  10 #---------------------------------------------------------------------- 
  14 python 
= sys
.executable
 
  15 destdir 
= os
.path
.split(python
)[0] 
  16 pythonw 
= os
.path
.join(destdir
, 'pythonw') 
  17 scriptdir 
= os
.getcwd() 
  22 from CreateBatchFiles 
import scripts
 
  23 repltxt 
= "#!/usr/bin/env python" 
  27 exec /Applications/Python.app/Contents/MacOS/python %s.py 
  31     for script
, usegui 
in scripts
: 
  32         destfile 
= os
.path
.join(destdir
, script
) 
  33         thescript 
= open(script
).read() 
  35             f 
= open(destfile
+'.py', 'w') 
  37             f
.write(thescript
.replace(repltxt
, '')) 
  39             f 
= open(destfile
, 'w') 
  41             f
.write(gui_template 
% destfile
) 
  45             thescript 
= thescript
.replace(repltxt
, '#!'+python
) 
  46             f 
= open(destfile
, 'w') 
  51         os
.chmod(destfile
, 0755) 
  54 if __name__ 
== '__main__':