From 6764b697e71f443469366ac1bd3662b1c3795c31 Mon Sep 17 00:00:00 2001 From: Allan Clark Date: Thu, 2 Nov 2023 12:05:56 -0700 Subject: [PATCH] fix: adapt to python2 phasing out --- internal_deps.bzl | 24 ++++++++++++++++--- ...thon-version-PY2-per-rules_pkg-PR169.patch | 14 +++++++++++ 2 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 lib/bazel/fix-python-version-PY2-per-rules_pkg-PR169.patch diff --git a/internal_deps.bzl b/internal_deps.bzl index 7750ea8..704baad 100644 --- a/internal_deps.bzl +++ b/internal_deps.bzl @@ -12,11 +12,29 @@ def rules_jq_internal_deps(): maybe( http_archive, name = "rules_pkg", + patch_args = ["-p1"], + patches = [ + # https://github.com/bazelbuild/rules_pkg/pull/169 + "//:lib/bazel/fix-python-version-PY2-per-rules_pkg-PR169.patch", + ], urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.2.4/rules_pkg-0.2.4.tar.gz", - "https://github.com/bazelbuild/rules_pkg/releases/download/0.2.4/rules_pkg-0.2.4.tar.gz", + "https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.2.5/rules_pkg-0.2.5.tar.gz", + "https://github.com/bazelbuild/rules_pkg/releases/download/0.2.5/rules_pkg-0.2.5.tar.gz", ], - sha256 = "4ba8f4ab0ff85f2484287ab06c0d871dcb31cc54d439457d28fd4ae14b18450a", + sha256 = "352c090cc3d3f9a6b4e676cf42a6047c16824959b438895a76c2989c6d7c246a", + ) + + # NOTE: in making minimal changes, the typical load of py_repositories() from + # python:repositories.bzl was not necessary in WORKSPACE + # + # load("@rules_python//python:repositories.bzl", "py_repositories") + # py_repositories() + maybe( + http_archive, + name = "rules_python", + url = "https://github.com/bazelbuild/rules_python/releases/download/0.0.2/rules_python-0.0.2.tar.gz", + strip_prefix = "rules_python-0.0.2", + sha256 = "b5668cde8bb6e3515057ef465a35ad712214962f0b3a314e551204266c7be90c", ) maybe( diff --git a/lib/bazel/fix-python-version-PY2-per-rules_pkg-PR169.patch b/lib/bazel/fix-python-version-PY2-per-rules_pkg-PR169.patch new file mode 100644 index 0000000..61b29fb --- /dev/null +++ b/lib/bazel/fix-python-version-PY2-per-rules_pkg-PR169.patch @@ -0,0 +1,14 @@ +diff -ur rules_pkg/BUILD rules_pkg/BUILD +--- rules_pkg/BUILD 2023-11-02 11:32:55 ++++ rules_pkg/BUILD 2023-11-02 11:33:28 +@@ -35,8 +35,8 @@ + py_binary( + name = "build_tar", + srcs = ["build_tar.py"], +- python_version = "PY2", +- srcs_version = "PY2AND3", ++ python_version = "PY3", ++ srcs_version = "PY3", + visibility = ["//visibility:public"], + deps = [ + ":archive",