]> git.saurik.com Git - wxWidgets.git/blame - wxPython/scripts/CreateMacSripts.py
Added CW for Mac list file
[wxWidgets.git] / wxPython / scripts / CreateMacSripts.py
CommitLineData
2eb31f8b
RD
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
12import sys, os
13
14python = sys.executable
15destdir = os.path.split(python)[0]
16pythonw = os.path.join(destdir, 'pythonw')
17scriptdir = os.getcwd()
18
19from CreateBatchFiles import scripts
20repltxt = "#!/usr/bin/env python"
21
22gui_template = """\
23#!/bin/sh
24exec /Applications/Python.app/Contents/MacOS/python %s.py
25"""
26
27def 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
49if __name__ == '__main__':
50 main()
51