build.plat, vendor.*: don't join strings passed as _opts overrides.
Right now an array is expected in any _opts overrides, and if it is actually a string (because it is passed via an environment variable, usually), awkwardness results as each character is joined with ` `. Fixes #130.
This commit is contained in:
parent
b6b9f0fc21
commit
1ee21d2007
5 changed files with 23 additions and 16 deletions
|
|
@ -243,6 +243,12 @@ class TemplatedPlatform(Platform):
|
|||
else:
|
||||
return jinja2.Undefined(name=var)
|
||||
|
||||
def options(opts):
|
||||
if isinstance(opts, str):
|
||||
return opts
|
||||
else:
|
||||
return " ".join(opts)
|
||||
|
||||
def verbose(arg):
|
||||
if "NMIGEN_verbose" in os.environ:
|
||||
return arg
|
||||
|
|
@ -259,6 +265,7 @@ class TemplatedPlatform(Platform):
|
|||
try:
|
||||
source = textwrap.dedent(source).strip()
|
||||
compiled = jinja2.Template(source, trim_blocks=True, lstrip_blocks=True)
|
||||
compiled.environment.filters["options"] = options
|
||||
except jinja2.TemplateSyntaxError as e:
|
||||
e.args = ("{} (at {}:{})".format(e.message, origin, e.lineno),)
|
||||
raise
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue