blob: b6787910bac9ee9d01dabd427d6df68135e46231 [file] [log] [blame]
Jack Jansen5220d021996-07-10 13:19:08 +00001#
2# Given a module-list generated by findmodulefiles
3# generate the resource file with all needed modules
4#
5import macfs
6import py_resource
7import Res
8import sys
9
10def main():
11 fss, ok = macfs.PromptGetFile('Module sources listing:', 'TEXT')
12 if not ok:
13 sys.exit(0)
14 ofss, ok = macfs.StandardPutFile('PYC resource output file:')
15 if not ok:
16 sys.exit(0)
17 mfss, ok = macfs.PromptGetFile('Source for __main__ (or cancel):')
18 if ok:
19 mainfile = mfss.as_pathname()
20 else:
21 mainfile = None
22 fp = open(fss.as_pathname())
23 data = fp.read()
24 modules = eval(data)
25
26 fsid = py_resource.create(ofss.as_pathname(), creator='RSED')
27
28 if mainfile:
29 id, name = py_resource.frompyfile(mainfile, '__main__')
30 for module, source in modules:
31 if source:
32 id, name = py_resource.frompyfile(source)
33 print 'Wrote %d %s: %s'%(id, name, source)
34
35 Res.CloseResFile(fsid)
36
37if __name__ == '__main__':
38 main()
39 sys.exit(1)