mirror of
https://github.com/python/cpython.git
synced 2025-07-23 03:05:38 +00:00
Allow selecting a template in findtemplate(), so Classic programs can build Carbon applets and vice-versa.
This commit is contained in:
parent
881cd36853
commit
a4f8e58058
1 changed files with 8 additions and 6 deletions
|
@ -40,19 +40,21 @@ READ = 1
|
||||||
WRITE = 2
|
WRITE = 2
|
||||||
|
|
||||||
|
|
||||||
def findtemplate():
|
def findtemplate(template=None):
|
||||||
"""Locate the applet template along sys.path"""
|
"""Locate the applet template along sys.path"""
|
||||||
|
if not template:
|
||||||
|
template=TEMPLATE
|
||||||
for p in sys.path:
|
for p in sys.path:
|
||||||
template = os.path.join(p, TEMPLATE)
|
file = os.path.join(p, template)
|
||||||
try:
|
try:
|
||||||
template, d1, d2 = macfs.ResolveAliasFile(template)
|
file, d1, d2 = macfs.ResolveAliasFile(file)
|
||||||
break
|
break
|
||||||
except (macfs.error, ValueError):
|
except (macfs.error, ValueError):
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
raise BuildError, "Template %s not found on sys.path" % `TEMPLATE`
|
raise BuildError, "Template %s not found on sys.path" % `template`
|
||||||
template = template.as_pathname()
|
file = file.as_pathname()
|
||||||
return template
|
return file
|
||||||
|
|
||||||
|
|
||||||
def process(template, filename, output, copy_codefragment):
|
def process(template, filename, output, copy_codefragment):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue