Commit 808b70b0 authored by Matthias Braun's avatar Matthias Braun
Browse files

make -I modify python searchpath too

parent 6e276861
......@@ -17,7 +17,7 @@ def main(argv):
help='doxygen tag file for link generation')
parser.add_argument('-I', dest='includedirs', action='store', nargs='*',
default=[],
help='include directories for template require directives',
help='include directories for templates/python modules',
metavar='DIR')
parser.add_argument('-D', dest='definitions', action='append',
help='definition exported to jinja',
......@@ -28,10 +28,16 @@ def main(argv):
help='jinja2 template file')
config = parser.parse_args()
# Append includedirs to python path and template loader searchpath
for dir in config.includedirs:
sys.path.insert(1, dir)
loader = jinjautil.SimpleLoader()
loader.includedirs += config.includedirs
# Load specfile
imp.load_source('spec', config.specfile)
loader = jinjautil.SimpleLoader()
env = Environment(loader=loader, keep_trailing_newline=True)
env.globals.update(jinjautil.exports)
env.filters.update(jinjautil.filters)
......@@ -43,7 +49,6 @@ def main(argv):
(name, replacement) = definition.split("=", 1)
env.globals[name] = replacement
loader.includedirs += config.includedirs
template = env.get_template(config.templatefile)
result = template.render()
sys.stdout.write(result)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment