mirror of
https://github.com/python/cpython.git
synced 2025-10-24 15:36:26 +00:00
Modified to allow it to run in MachoPython in a reasonable way. It still
needs a decent commandline interface, though.
This commit is contained in:
parent
c2ce91af5f
commit
4092606d6b
1 changed files with 17 additions and 10 deletions
|
|
@ -14,10 +14,17 @@ import types
|
||||||
import StringIO
|
import StringIO
|
||||||
import macfs
|
import macfs
|
||||||
import keyword
|
import keyword
|
||||||
|
import macresource
|
||||||
|
|
||||||
from Carbon.Res import *
|
from Carbon.Res import *
|
||||||
|
|
||||||
|
DEFAULT_PACKAGEFOLDER=os.path.join(sys.prefix, 'Mac', 'Lib', 'lib-scriptpackages')
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
if len(sys.argv) > 1:
|
||||||
|
for filename in sys.argv[1:]:
|
||||||
|
processfile(filename)
|
||||||
|
else:
|
||||||
fss, ok = macfs.PromptGetFile('Select file with aeut/aete resource:')
|
fss, ok = macfs.PromptGetFile('Select file with aeut/aete resource:')
|
||||||
if not ok:
|
if not ok:
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
@ -26,8 +33,8 @@ def main():
|
||||||
def processfile(fullname):
|
def processfile(fullname):
|
||||||
"""Process all resources in a single file"""
|
"""Process all resources in a single file"""
|
||||||
cur = CurResFile()
|
cur = CurResFile()
|
||||||
print fullname
|
print "Processing", fullname
|
||||||
rf = OpenRFPerm(fullname, 0, 1)
|
rf = macresource.open_pathname(fullname)
|
||||||
try:
|
try:
|
||||||
UseResFile(rf)
|
UseResFile(rf)
|
||||||
resources = []
|
resources = []
|
||||||
|
|
@ -225,15 +232,15 @@ def compileaete(aete, resinfo, fname):
|
||||||
major, minor = divmod(version, 256)
|
major, minor = divmod(version, 256)
|
||||||
fss = macfs.FSSpec(fname)
|
fss = macfs.FSSpec(fname)
|
||||||
creatorsignature, dummy = fss.GetCreatorType()
|
creatorsignature, dummy = fss.GetCreatorType()
|
||||||
packagename = identify(os.path.basename(fname))
|
packagename = identify(os.path.splitext(os.path.basename(fname))[0])
|
||||||
if language:
|
if language:
|
||||||
packagename = packagename+'_lang%d'%language
|
packagename = packagename+'_lang%d'%language
|
||||||
if script:
|
if script:
|
||||||
packagename = packagename+'_script%d'%script
|
packagename = packagename+'_script%d'%script
|
||||||
if len(packagename) > 27:
|
if len(packagename) > 27:
|
||||||
packagename = packagename[:27]
|
packagename = packagename[:27]
|
||||||
macfs.SetFolder(os.path.join(sys.prefix, ':Mac:Lib:lib-scriptpackages'))
|
macfs.SetFolder(DEFAULT_PACKAGEFOLDER)
|
||||||
fss, ok = macfs.GetDirectory('Package folder for %s'%packagename)
|
fss, ok = macfs.GetDirectory('Create and select package folder for %s'%packagename)
|
||||||
if not ok:
|
if not ok:
|
||||||
return
|
return
|
||||||
pathname = fss.as_pathname()
|
pathname = fss.as_pathname()
|
||||||
|
|
@ -288,7 +295,7 @@ def compileaete(aete, resinfo, fname):
|
||||||
for code, modname in suitelist[1:]:
|
for code, modname in suitelist[1:]:
|
||||||
fp.write(",\n\t\t%s_Events"%modname)
|
fp.write(",\n\t\t%s_Events"%modname)
|
||||||
fp.write(",\n\t\taetools.TalkTo):\n")
|
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()
|
fp.close()
|
||||||
|
|
||||||
def precompilesuite(suite, basepackage=None):
|
def precompilesuite(suite, basepackage=None):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue