Allow selecting a template in findtemplate(), so Classic programs can build Carbon applets and vice-versa.

This commit is contained in:
Jack Jansen 2001-02-17 23:30:19 +00:00
parent 881cd36853
commit a4f8e58058
1 changed files with 8 additions and 6 deletions

View File

@ -40,19 +40,21 @@ READ = 1
WRITE = 2
def findtemplate():
def findtemplate(template=None):
"""Locate the applet template along sys.path"""
if not template:
template=TEMPLATE
for p in sys.path:
template = os.path.join(p, TEMPLATE)
file = os.path.join(p, template)
try:
template, d1, d2 = macfs.ResolveAliasFile(template)
file, d1, d2 = macfs.ResolveAliasFile(file)
break
except (macfs.error, ValueError):
continue
else:
raise BuildError, "Template %s not found on sys.path" % `TEMPLATE`
template = template.as_pathname()
return template
raise BuildError, "Template %s not found on sys.path" % `template`
file = file.as_pathname()
return file
def process(template, filename, output, copy_codefragment):