From: Jack Jansen Date: Sat, 17 Feb 2001 23:30:19 +0000 (+0000) Subject: Allow selecting a template in findtemplate(), so Classic programs can build Carbon... X-Git-Tag: v2.1b1~316 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a4f8e580588b7ebd5fde61debab3fdb72f37cdec;p=thirdparty%2FPython%2Fcpython.git Allow selecting a template in findtemplate(), so Classic programs can build Carbon applets and vice-versa. --- diff --git a/Mac/Lib/buildtools.py b/Mac/Lib/buildtools.py index 2a8fd03cfb2e..dd2e30e3bfad 100644 --- a/Mac/Lib/buildtools.py +++ b/Mac/Lib/buildtools.py @@ -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):