]> git.saurik.com Git - wxWidgets.git/blob - wxPython/scripts/CreateMacSripts.py
This way strconv copmiles again. I don't think
[wxWidgets.git] / wxPython / scripts / CreateMacSripts.py
1 #----------------------------------------------------------------------
2 # Name: CreateMacScriptspy
3 # Purpose: Massages the scripts to be usable with MachoPython
4 #
5 # Author: Robin Dunn
6 #
7 # Created: 12-Aug-2002
8 # Copyright: (c) 2002 by Total Control Software
9 # Licence: wxWindows license
10 #----------------------------------------------------------------------
11
12 import sys, os
13
14 python = sys.executable
15 destdir = os.path.split(python)[0]
16 pythonw = os.path.join(destdir, 'pythonw')
17 scriptdir = os.getcwd()
18
19 from CreateBatchFiles import scripts
20 repltxt = "#!/usr/bin/env python"
21
22 gui_template = """\
23 #!/bin/sh
24 exec /Applications/Python.app/Contents/MacOS/python %s.py
25 """
26
27 def main():
28 for script, usegui in scripts:
29 destfile = os.path.join(destdir, script)
30 print "Creating", destfile
31 thescript = open(script).read()
32 if usegui:
33 f = open(destfile+'.py', 'w')
34 f.write(thescript.replace(repltxt, ''))
35 f.close()
36 f = open(destfile, 'w')
37 f.write(gui_template % destfile)
38 f.close()
39
40 else:
41 thescript = thescript.replace(repltxt, '#!'+python)
42 f = open(destfile, 'w')
43 f.write(thescript)
44 f.close()
45
46 os.chmod(destfile, 0755)
47
48
49 if __name__ == '__main__':
50 main()
51