]> granicus.if.org Git - python/commitdiff
Allow selecting a template in findtemplate(), so Classic programs can build Carbon...
authorJack Jansen <jack.jansen@cwi.nl>
Sat, 17 Feb 2001 23:30:19 +0000 (23:30 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Sat, 17 Feb 2001 23:30:19 +0000 (23:30 +0000)
Mac/Lib/buildtools.py

index 2a8fd03cfb2eba8052b5aded19901fe890714102..dd2e30e3bfadb6d0410a97aedfae3b3f79364433 100644 (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):