]>
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 MacPython-OSX 
   8 # Copyright:    (c) 2002 by Total Control Software 
   9 # Licence:      wxWindows license 
  10 #---------------------------------------------------------------------- 
  14 python 
= sys
.executable
 
  15 destdir 
= os
.path
.split(python
)[0] 
  17 pythonw 
= os
.path
.join(destdir
, 'pythonw') 
  18 scriptdir 
= os
.getcwd() 
  22     p 
= prefix 
= sys
.argv
[2] 
  23     if p
[0] == '/': p 
= p
[1:] 
  24     destdir 
= os
.path
.join(root
, p
) 
  27 from CreateBatchFiles 
import scripts
 
  28 repltxt 
= "#!/usr/bin/env python" 
  30 # use the existing pythonw as a template 
  34 """ % (sys
.executable
)  
  37     for script
, usegui 
in scripts
: 
  38         destfile 
= os
.path
.join(destdir
, script
) 
  39         prefixfile 
= os
.path
.join(prefix
, script
) 
  41         thescript 
= open(script
).read() 
  43             f 
= open(destfile
+'.py', 'w') 
  45             f
.write(thescript
.replace(repltxt
, '')) 
  47             f 
= open(destfile
, 'w') 
  49             f
.write(gui_template 
% prefixfile
) 
  53             thescript 
= thescript
.replace(repltxt
, '#!'+python
) 
  54             f 
= open(destfile
, 'w') 
  59         os
.chmod(destfile
, 0755) 
  62 if __name__ 
== '__main__':