diff --git a/bazel/external/jinja.BUILD b/bazel/external/jinja.BUILD index f7ce6718caeb..57ca1db52455 100644 --- a/bazel/external/jinja.BUILD +++ b/bazel/external/jinja.BUILD @@ -1,8 +1,28 @@ licenses(["notice"]) # Apache 2 +# Starting with 2.11, the jinja2 distribution does not keep the source files in a directory with +# the expected package name (it uses 'src/jinja2' instead of 'jinja2'), so we provide a genrule to +# copy src/jinja2/*.py to jinja2/*.py. + +src_files = glob(["src/jinja2/*.py"]) + +genrule( + name = "jinja_files", + srcs = src_files, + outs = [f.replace("src/jinja2/", "jinja2/") for f in src_files], + cmd = "\n".join( + ["mkdir -p $$(dirname $(location %s)) && cp $(location %s) $(location :%s)" % ( + f, + f, + f.replace("src/jinja2/", "jinja2/"), + ) for f in src_files], + ), + visibility = ["//visibility:private"], +) + py_library( name = "jinja2", - srcs = glob(["jinja2/**/*.py"]), + srcs = [":jinja_files"], visibility = ["//visibility:public"], deps = ["@com_github_pallets_markupsafe//:markupsafe"], ) diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl index 17a3eab8cd70..e37e2cbfcb1f 100644 --- a/bazel/repository_locations.bzl +++ b/bazel/repository_locations.bzl @@ -251,9 +251,9 @@ DEPENDENCY_REPOSITORIES = dict( use_category = ["dataplane"], ), com_github_pallets_jinja = dict( - sha256 = "db49236731373e4f3118af880eb91bb0aa6978bc0cf8b35760f6a026f1a9ffc4", - strip_prefix = "jinja-2.10.3", - urls = ["https://github.com/pallets/jinja/archive/2.10.3.tar.gz"], + sha256 = "c5720a681bf1c5b11e184af32e6a8ce28670911787702b20cd0367e3877bbcae", + strip_prefix = "jinja-2.11.2", + urls = ["https://github.com/pallets/jinja/archive/2.11.2.tar.gz"], use_category = ["build"], ), com_github_pallets_markupsafe = dict( diff --git a/configs/requirements.txt b/configs/requirements.txt index 83e5040a3fc9..60ffe02f13e3 100644 --- a/configs/requirements.txt +++ b/configs/requirements.txt @@ -1 +1 @@ -jinja2==2.10.3 +jinja2==2.11.2 diff --git a/docs/requirements.txt b/docs/requirements.txt index 683f5c59b938..7288336d8844 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,5 +1,5 @@ GitPython==3.1.1 -Jinja2==2.10.3 +Jinja2==2.11.2 MarkupSafe==1.1.1 Pygments==2.4.2 alabaster==0.7.12