Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jinja2 dependency upgrade: 2.10.3 -> 2.11.2 #11023

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion bazel/external/jinja.BUILD
Original file line number Diff line number Diff line change
@@ -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"],
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed on Slack, I reckon https://github.com/bazelbuild/rules_python would be a better option and probably more maintainable. I don't think it would be a ton of work to get happening, but famous last words. If you prefer you can file an issue and put a TODO here.

Out of curiosity, would https://docs.bazel.build/versions/master/be/python.html#py_binary.imports have been any help?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't get imports to work, but I've had only limited exposure to bazel.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure; I'm actually doing some of the required plumbing here in #11058, so in the near future we might have pip3 support in the repository.


py_library(
name = "jinja2",
srcs = glob(["jinja2/**/*.py"]),
srcs = [":jinja_files"],
visibility = ["//visibility:public"],
deps = ["@com_github_pallets_markupsafe//:markupsafe"],
)
6 changes: 3 additions & 3 deletions bazel/repository_locations.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion configs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
jinja2==2.10.3
jinja2==2.11.2
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down