From 046f4959dfc4d30ed79300dfc7ff12cc00c1c92c Mon Sep 17 00:00:00 2001 From: Sridhar Jonnalagadda Date: Sat, 17 Aug 2024 03:48:00 +0000 Subject: [PATCH] issue: 882 Upgrading rules_python version and fixed a regression test issue --- MODULE.bazel | 2 +- distro/packaging_test.py | 4 ++-- examples/naming_package_files/WORKSPACE | 4 ++++ examples/naming_package_files/WORKSPACE.bzlmod | 8 ++++++++ examples/rich_structure/WORKSPACE | 5 +++++ examples/time_stamping/WORKSPACE | 5 +++++ pkg/deps.bzl | 6 +++--- pkg/releasing/release_tools.py | 7 +++++++ 8 files changed, 35 insertions(+), 6 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 50f75909..bebc0c88 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -7,7 +7,7 @@ module( # Do not update to newer versions until you need a specific new feature. bazel_dep(name = "rules_license", version = "0.0.7") -bazel_dep(name = "rules_python", version = "0.31.0") +bazel_dep(name = "rules_python", version = "0.34.0") bazel_dep(name = "bazel_skylib", version = "1.4.2") # Only for development diff --git a/distro/packaging_test.py b/distro/packaging_test.py index 38c34c85..b7c8022d 100644 --- a/distro/packaging_test.py +++ b/distro/packaging_test.py @@ -72,7 +72,8 @@ def testBuild(self): 'file://%s' % local_path, self.source_repo, sha256, rename_repo=self.dest_repo, deps_method='rules_pkg_dependencies' - ) + ), + release_tools.rules_python_internal_content() )) workspace.write(workspace_content) if _VERBOSE: @@ -90,7 +91,6 @@ def CopyTestFile(source_name, dest_name): out.write(content) CopyTestFile('BUILD.tpl', 'BUILD') - os.chdir(tempdir) build_result = subprocess.check_output(['bazel', 'build', ':dummy_tar']) if _VERBOSE: diff --git a/examples/naming_package_files/WORKSPACE b/examples/naming_package_files/WORKSPACE index 0e5b0d9d..44fc49b3 100644 --- a/examples/naming_package_files/WORKSPACE +++ b/examples/naming_package_files/WORKSPACE @@ -24,6 +24,10 @@ local_repository( load("@rules_pkg//pkg:deps.bzl", "rules_pkg_dependencies") rules_pkg_dependencies() +load("@rules_python//:internal_deps.bzl", "rules_python_internal_deps") +rules_python_internal_deps() +load("@rules_python//:internal_setup.bzl", "rules_python_internal_setup") +rules_python_internal_setup() http_archive( name = "rules_cc", diff --git a/examples/naming_package_files/WORKSPACE.bzlmod b/examples/naming_package_files/WORKSPACE.bzlmod index ac785ffd..350638e2 100644 --- a/examples/naming_package_files/WORKSPACE.bzlmod +++ b/examples/naming_package_files/WORKSPACE.bzlmod @@ -6,3 +6,11 @@ local_repository( load("@rules_pkg//pkg:deps.bzl", "rules_pkg_dependencies") rules_pkg_dependencies() + +load("@rules_python//:internal_deps.bzl", "rules_python_internal_deps") + +rules_python_internal_deps() + +load("@rules_python//:internal_setup.bzl", "rules_python_internal_setup") + +rules_python_internal_setup() diff --git a/examples/rich_structure/WORKSPACE b/examples/rich_structure/WORKSPACE index 49865945..7ad681f4 100644 --- a/examples/rich_structure/WORKSPACE +++ b/examples/rich_structure/WORKSPACE @@ -25,6 +25,11 @@ load("@rules_pkg//pkg:deps.bzl", "rules_pkg_dependencies") rules_pkg_dependencies() +load("@rules_python//:internal_deps.bzl", "rules_python_internal_deps") +rules_python_internal_deps() +load("@rules_python//:internal_setup.bzl", "rules_python_internal_setup") +rules_python_internal_setup() + http_archive( name = "rules_cc", sha256 = "2037875b9a4456dce4a79d112a8ae885bbc4aad968e6587dca6e64f3a0900cdf", diff --git a/examples/time_stamping/WORKSPACE b/examples/time_stamping/WORKSPACE index d170970e..a0a34ed1 100644 --- a/examples/time_stamping/WORKSPACE +++ b/examples/time_stamping/WORKSPACE @@ -22,3 +22,8 @@ local_repository( load("@rules_pkg//pkg:deps.bzl", "rules_pkg_dependencies") rules_pkg_dependencies() + +load("@rules_python//:internal_deps.bzl", "rules_python_internal_deps") +rules_python_internal_deps() +load("@rules_python//:internal_setup.bzl", "rules_python_internal_setup") +rules_python_internal_setup() diff --git a/pkg/deps.bzl b/pkg/deps.bzl index 1fecfbfb..2ccb2f1b 100644 --- a/pkg/deps.bzl +++ b/pkg/deps.bzl @@ -41,9 +41,9 @@ def rules_pkg_dependencies(): http_archive( name = "rules_python", - sha256 = "0a8003b044294d7840ac7d9d73eef05d6ceb682d7516781a4ec62eeb34702578", - strip_prefix = "rules_python-0.24.0", - url = "https://github.com/bazelbuild/rules_python/releases/download/0.24.0/rules_python-0.24.0.tar.gz", + sha256 = "778aaeab3e6cfd56d681c89f5c10d7ad6bf8d2f1a72de9de55b23081b2d31618", + strip_prefix = "rules_python-0.34.0", + url = "https://github.com/bazelbuild/rules_python/releases/download/0.34.0/rules_python-0.34.0.tar.gz", ) http_archive( diff --git a/pkg/releasing/release_tools.py b/pkg/releasing/release_tools.py index 52440de4..70c0f93d 100644 --- a/pkg/releasing/release_tools.py +++ b/pkg/releasing/release_tools.py @@ -101,3 +101,10 @@ def workspace_content( ret += '%s()\n' % m return ret + +def rules_python_internal_content(): + ret = 'load("@rules_python//:internal_deps.bzl", "rules_python_internal_deps")' + ret += '\n\nrules_python_internal_deps()\n' + ret += 'load("@rules_python//:internal_setup.bzl", "rules_python_internal_setup")' + ret += '\n\nrules_python_internal_setup()\n' + return ret