summaryrefslogtreecommitdiff
path: root/Mac/Lib/buildtools.py
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2002-08-02 14:57:43 +0000
committerJack Jansen <jack.jansen@cwi.nl>2002-08-02 14:57:43 +0000
commitba1c13db4fbebd7fd1917937a0fe3822068dfc5e (patch)
tree9349740757e81d3b80fc6630edd8f6a9daaeb24c /Mac/Lib/buildtools.py
parenta9454e21a70fecfe3686682ea4de716a75a3d828 (diff)
downloadcpython-git-ba1c13db4fbebd7fd1917937a0fe3822068dfc5e.tar.gz
Final step in making applets first-class citizens: if the applet wants
argv emulation (i.e. if the end user drops files and folders on the applets these will show up in sys.argv) BuildApplet will add the required code to the applet bundle, in __rawmain__.pyc. This code is compiled from appletrawmain.py, it creates sys.argv, cleans up most of the mess and executes either __main__.py or __main__.pyc.
Diffstat (limited to 'Mac/Lib/buildtools.py')
-rw-r--r--Mac/Lib/buildtools.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Mac/Lib/buildtools.py b/Mac/Lib/buildtools.py
index 982570855b..1047da5713 100644
--- a/Mac/Lib/buildtools.py
+++ b/Mac/Lib/buildtools.py
@@ -398,6 +398,16 @@ def process_common_macho(template, progress, code, rsrcname, destname, is_update
pycname = '__rawmain__.pyc'
else:
pycname = '__main__.pyc'
+ # And we also create __rawmain__.pyc
+ outputfilename = os.path.join(destname, 'Contents', 'Resources', '__rawmain__.pyc')
+ if progress:
+ progress.label('Creating __rawmain__.pyc')
+ progress.inc(0)
+ rawsourcefile = os.path.join(sys.prefix, 'Mac', 'Lib', 'appletrawmain.py')
+ rawsource = open(rawsourcefile, 'rU').read()
+ rawcode = compile(rawsource, rawsourcefile, 'exec')
+ writepycfile(rawcode, outputfilename)
+
outputfilename = os.path.join(destname, 'Contents', 'Resources', pycname)
if progress:
progress.label('Creating '+pycname)