OSX has a problem with the form:
__import__('a/b/c') Replaced with a variation of: sys.path.append(os.path.join('a','b')) __import__('c')
This commit is contained in:
parent
1fb1e07c10
commit
eee4075fe8
@ -1,5 +1,6 @@
|
|||||||
import planet
|
import planet
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
def run(template_file, doc):
|
def run(template_file, doc):
|
||||||
""" select a template module based on file extension and execute it """
|
""" select a template module based on file extension and execute it """
|
||||||
@ -11,14 +12,14 @@ def run(template_file, doc):
|
|||||||
else:
|
else:
|
||||||
return log.error("Unable to locate template %s", template_file)
|
return log.error("Unable to locate template %s", template_file)
|
||||||
|
|
||||||
|
sys.path.append(os.path.join('planet','shell'))
|
||||||
|
|
||||||
base,ext = os.path.splitext(os.path.basename(template_resolved))
|
base,ext = os.path.splitext(os.path.basename(template_resolved))
|
||||||
try:
|
try:
|
||||||
template_module_name = os.path.join('planet', 'shell', ext[1:])
|
template_module_name = ext[1:]
|
||||||
template_module = __import__(template_module_name)
|
template_module = __import__(template_module_name)
|
||||||
except ImportError, inst:
|
|
||||||
return log.error("Skipping template '%s' after failing to load '%s': %s", template_resolved, template_module_name, inst)
|
|
||||||
except Exception, inst:
|
except Exception, inst:
|
||||||
return log.error("Unknown exception: %s", inst)
|
return log.error("Skipping template '%s' after failing to load '%s': %s", template_resolved, template_module_name, inst)
|
||||||
|
|
||||||
log.info("Processing template %s from %s", template_resolved, template_module_name)
|
log.info("Processing template %s from %s", template_resolved, template_module_name)
|
||||||
output_dir = planet.config.output_dir()
|
output_dir = planet.config.output_dir()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user