diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 2002-03-30 23:43:04 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 2002-03-30 23:43:04 (GMT) |
commit | 4092606d6bad63f15009d8a2b2b6d37e62e74cc8 (patch) | |
tree | 1e540e71cb67daa36d9cd1fecebfcebd0bfe23a5 /Mac/scripts/gensuitemodule.py | |
parent | c2ce91af5fbe71c5e12d78b0021701233aacde31 (diff) | |
download | cpython-4092606d6bad63f15009d8a2b2b6d37e62e74cc8.zip cpython-4092606d6bad63f15009d8a2b2b6d37e62e74cc8.tar.gz cpython-4092606d6bad63f15009d8a2b2b6d37e62e74cc8.tar.bz2 |
Modified to allow it to run in MachoPython in a reasonable way. It still
needs a decent commandline interface, though.
Diffstat (limited to 'Mac/scripts/gensuitemodule.py')
-rw-r--r-- | Mac/scripts/gensuitemodule.py | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/Mac/scripts/gensuitemodule.py b/Mac/scripts/gensuitemodule.py index 5a4c806..4f2ddc0 100644 --- a/Mac/scripts/gensuitemodule.py +++ b/Mac/scripts/gensuitemodule.py @@ -14,20 +14,27 @@ import types import StringIO import macfs import keyword +import macresource from Carbon.Res import * +DEFAULT_PACKAGEFOLDER=os.path.join(sys.prefix, 'Mac', 'Lib', 'lib-scriptpackages') + def main(): - fss, ok = macfs.PromptGetFile('Select file with aeut/aete resource:') - if not ok: - sys.exit(0) - processfile(fss.as_pathname()) + if len(sys.argv) > 1: + for filename in sys.argv[1:]: + processfile(filename) + else: + fss, ok = macfs.PromptGetFile('Select file with aeut/aete resource:') + if not ok: + sys.exit(0) + processfile(fss.as_pathname()) def processfile(fullname): """Process all resources in a single file""" cur = CurResFile() - print fullname - rf = OpenRFPerm(fullname, 0, 1) + print "Processing", fullname + rf = macresource.open_pathname(fullname) try: UseResFile(rf) resources = [] @@ -225,15 +232,15 @@ def compileaete(aete, resinfo, fname): major, minor = divmod(version, 256) fss = macfs.FSSpec(fname) creatorsignature, dummy = fss.GetCreatorType() - packagename = identify(os.path.basename(fname)) + packagename = identify(os.path.splitext(os.path.basename(fname))[0]) if language: packagename = packagename+'_lang%d'%language if script: packagename = packagename+'_script%d'%script if len(packagename) > 27: packagename = packagename[:27] - macfs.SetFolder(os.path.join(sys.prefix, ':Mac:Lib:lib-scriptpackages')) - fss, ok = macfs.GetDirectory('Package folder for %s'%packagename) + macfs.SetFolder(DEFAULT_PACKAGEFOLDER) + fss, ok = macfs.GetDirectory('Create and select package folder for %s'%packagename) if not ok: return pathname = fss.as_pathname() @@ -288,7 +295,7 @@ def compileaete(aete, resinfo, fname): for code, modname in suitelist[1:]: fp.write(",\n\t\t%s_Events"%modname) fp.write(",\n\t\taetools.TalkTo):\n") - fp.write("\t_signature = '%s'\n\n"%creatorsignature) + fp.write("\t_signature = %s\n\n"%`creatorsignature`) fp.close() def precompilesuite(suite, basepackage=None): |