diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 2000-09-12 20:24:50 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 2000-09-12 20:24:50 (GMT) |
commit | 9c940ca1438b774b736863981e76ca81f459204f (patch) | |
tree | 73704d48e2a2e5fffe50ce0a67bef1d5cf6d2959 /Mac/Unsupported/mkfrozenresources.py | |
parent | f913e542bee40dfb83642a903c74e76566694c69 (diff) | |
download | cpython-9c940ca1438b774b736863981e76ca81f459204f.zip cpython-9c940ca1438b774b736863981e76ca81f459204f.tar.gz cpython-9c940ca1438b774b736863981e76ca81f459204f.tar.bz2 |
Moved to Unsupported.
Diffstat (limited to 'Mac/Unsupported/mkfrozenresources.py')
-rw-r--r-- | Mac/Unsupported/mkfrozenresources.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Mac/Unsupported/mkfrozenresources.py b/Mac/Unsupported/mkfrozenresources.py new file mode 100644 index 0000000..b678791 --- /dev/null +++ b/Mac/Unsupported/mkfrozenresources.py @@ -0,0 +1,39 @@ +# +# Given a module-list generated by findmodulefiles +# generate the resource file with all needed modules +# +import macfs +import py_resource +import Res +import sys + +def main(): + fss, ok = macfs.PromptGetFile('Module sources listing:', 'TEXT') + if not ok: + sys.exit(0) + ofss, ok = macfs.StandardPutFile('PYC resource output file:') + if not ok: + sys.exit(0) + mfss, ok = macfs.PromptGetFile('Source for __main__ (or cancel):') + if ok: + mainfile = mfss.as_pathname() + else: + mainfile = None + fp = open(fss.as_pathname()) + data = fp.read() + modules = eval(data) + + fsid = py_resource.create(ofss.as_pathname(), creator='RSED') + + if mainfile: + id, name = py_resource.frompyfile(mainfile, '__main__') + for module, source in modules: + if source: + id, name = py_resource.frompyfile(source) + print 'Wrote %d %s: %s'%(id, name, source) + + Res.CloseResFile(fsid) + +if __name__ == '__main__': + main() + sys.exit(1) |