]> git.saurik.com Git - wxWidgets.git/blame - wxPython/scripts/CreateMacScripts.py
Removed rundant files, updated readme.txt.
[wxWidgets.git] / wxPython / scripts / CreateMacScripts.py
CommitLineData
2eb31f8b 1#----------------------------------------------------------------------
9c6b4824 2# Name: CreateMacScripts.py
2eb31f8b
RD
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
9c6b4824
RD
19if len(sys.argv) > 1:
20 destdir = sys.argv[1]
21
2eb31f8b
RD
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)
2eb31f8b
RD
33 thescript = open(script).read()
34 if usegui:
35 f = open(destfile+'.py', 'w')
9c6b4824 36 print destfile+'.py'
2eb31f8b
RD
37 f.write(thescript.replace(repltxt, ''))
38 f.close()
39 f = open(destfile, 'w')
9c6b4824 40 print destfile
2eb31f8b
RD
41 f.write(gui_template % destfile)
42 f.close()
43
44 else:
45 thescript = thescript.replace(repltxt, '#!'+python)
46 f = open(destfile, 'w')
9c6b4824 47 print destfile
2eb31f8b
RD
48 f.write(thescript)
49 f.close()
50
51 os.chmod(destfile, 0755)
52
53
54if __name__ == '__main__':
55 main()
56