]> git.saurik.com Git - wxWidgets.git/blame_incremental - wxPython/scripts/CreateMacScripts.py
fix Alt-letter navigation with spin controls (bug 672974)
[wxWidgets.git] / wxPython / scripts / CreateMacScripts.py
... / ...
CommitLineData
1#----------------------------------------------------------------------
2# Name: CreateMacScripts.py
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
12import sys, os
13
14python = sys.executable
15destdir = os.path.split(python)[0]
16pythonw = os.path.join(destdir, 'pythonw')
17scriptdir = os.getcwd()
18
19if len(sys.argv) > 1:
20 destdir = sys.argv[1]
21
22from CreateBatchFiles import scripts
23repltxt = "#!/usr/bin/env python"
24
25gui_template = """\
26#!/bin/sh
27exec /Applications/Python.app/Contents/MacOS/python %s.py
28"""
29
30def main():
31 for script, usegui in scripts:
32 destfile = os.path.join(destdir, script)
33 thescript = open(script).read()
34 if usegui:
35 f = open(destfile+'.py', 'w')
36 print destfile+'.py'
37 f.write(thescript.replace(repltxt, ''))
38 f.close()
39 f = open(destfile, 'w')
40 print destfile
41 f.write(gui_template % destfile)
42 f.close()
43
44 else:
45 thescript = thescript.replace(repltxt, '#!'+python)
46 f = open(destfile, 'w')
47 print destfile
48 f.write(thescript)
49 f.close()
50
51 os.chmod(destfile, 0755)
52
53
54if __name__ == '__main__':
55 main()
56