build.plat,setup: fix Jinja2 dependency.

Jinja2 version 2.11 has a broken dependency constraint that allows its
dependency on markupsafe to pull in a version that it is not actually
compatible with the interface of. Fix this by upgrading the dependency
to `~=3.0`. This requires a small patch to the code to replace the
deprecated `@jinja2.contextfunction` decorator with the replacement
`@jinja2.pass_context`since `@jinja2.contextfunction` is removed in
Jinja2 version 3.1.0.
This commit is contained in:
Irides 2022-03-30 15:49:26 -05:00 committed by Catherine
parent f6253b3851
commit 85d56a74a5
2 changed files with 2 additions and 2 deletions

View file

@ -375,7 +375,7 @@ class TemplatedPlatform(Platform):
else: else:
return jinja2.Undefined(name=var) return jinja2.Undefined(name=var)
@jinja2.contextfunction @jinja2.pass_context
def invoke_tool(context, name): def invoke_tool(context, name):
env_var = tool_env_var(name) env_var = tool_env_var(name)
if context.parent["syntax"] == "sh": if context.parent["syntax"] == "sh":

View file

@ -43,7 +43,7 @@ setup(
"importlib_metadata; python_version<'3.8'", # for __version__ and amaranth._toolchain.yosys "importlib_metadata; python_version<'3.8'", # for __version__ and amaranth._toolchain.yosys
"importlib_resources; python_version<'3.9'", # for amaranth._toolchain.yosys "importlib_resources; python_version<'3.9'", # for amaranth._toolchain.yosys
"pyvcd~=0.2.2", # for amaranth.pysim "pyvcd~=0.2.2", # for amaranth.pysim
"Jinja2>=2.11,<4.0", # for amaranth.build "Jinja2~=3.0", # for amaranth.build
], ],
extras_require={ extras_require={
# this version requirement needs to be synchronized with the one in amaranth.back.verilog! # this version requirement needs to be synchronized with the one in amaranth.back.verilog!