diff --git a/.bazelci/config.yaml b/.bazelci/config.yaml index caf80f5e7..4799fe23f 100644 --- a/.bazelci/config.yaml +++ b/.bazelci/config.yaml @@ -206,6 +206,9 @@ tasks: working_directory: examples min_supported_targets: &min_supported_targets - "//..." + # Requires Python 2 under Bazel 4; skip so that Bazel 7 can disable Python 2 + # See https://github.com/bazelbuild/bazel/issues/17293 + - "-//cmake_android:app" build_targets: *min_supported_targets # See comment above regarding --experimental_enable_aggregating_middleman=False build_flags: diff --git a/examples/third_party/python/BUILD.bazel b/examples/third_party/python/BUILD.bazel index c0d4785e0..515718c84 100644 --- a/examples/third_party/python/BUILD.bazel +++ b/examples/third_party/python/BUILD.bazel @@ -2,19 +2,11 @@ load("@rules_python//python:defs.bzl", "py_runtime", "py_runtime_pair", "py_test exports_files( [ - "BUILD.python2.bazel", "BUILD.python3.bazel", ], visibility = ["//visibility:public"], ) -py_runtime( - name = "py2_runtime", - files = ["@python2"], - interpreter = "@python2//:python2_bin", - python_version = "PY2", -) - py_runtime( name = "py3_runtime", files = ["@python3"], @@ -24,7 +16,6 @@ py_runtime( py_runtime_pair( name = "py_runtime_pair", - py2_runtime = ":py2_runtime", py3_runtime = ":py3_runtime", ) @@ -34,13 +25,6 @@ toolchain( toolchain_type = "@rules_python//python:toolchain_type", ) -py_test( - name = "python2_test", - srcs = ["python2_test.py"], - python_version = "PY2", - visibility = ["//:__pkg__"], -) - py_test( name = "python3_test", srcs = ["python3_test.py"], @@ -51,7 +35,6 @@ py_test( test_suite( name = "python_tests", tests = [ - ":python2_test", ":python3_test", ], ) diff --git a/examples/third_party/python/BUILD.python2.bazel b/examples/third_party/python/BUILD.python2.bazel deleted file mode 100644 index b93d3f000..000000000 --- a/examples/third_party/python/BUILD.python2.bazel +++ /dev/null @@ -1,55 +0,0 @@ -load("@rules_foreign_cc//foreign_cc:defs.bzl", "configure_make") - -package(default_visibility = ["//visibility:public"]) - -filegroup( - name = "all_srcs", - srcs = glob( - include = ["**"], - exclude = ["*.bazel"], - ), -) - -configure_make( - name = "python2", - build_data = select({ - "@platforms//os:macos": ["@subversion"], - "//conditions:default": [], - }), - configure_options = [ - "CFLAGS='-Dredacted=\"redacted\"'", - "--with-openssl=$EXT_BUILD_DEPS/openssl", - "--with-zlib=$EXT_BUILD_DEPS/zlib", - "--enable-optimizations", - ], - env = select({ - "@platforms//os:macos": {"AR": ""}, - "//conditions:default": {}, - }), - features = select({ - "@platforms//os:macos": ["-headerpad"], - "//conditions:default": {}, - }), - # rules_foreign_cc defaults the install_prefix to "python". This conflicts with the "python" executable that is generated. - install_prefix = "py_install", - lib_source = ":all_srcs", - out_binaries = [ - "python2.7", - ], - out_data_dirs = ["lib"], - # Building these targets rather than the default prevents tests from being run, which take a while - targets = [ - "build_all", - "altinstall", - ], - deps = [ - "@openssl", - "@zlib", - ], -) - -filegroup( - name = "python2_bin", - srcs = [":python2"], - output_group = "python2.7", -) diff --git a/examples/third_party/python/python2_test.py b/examples/third_party/python/python2_test.py deleted file mode 100644 index 1095e2537..000000000 --- a/examples/third_party/python/python2_test.py +++ /dev/null @@ -1,8 +0,0 @@ - -import sys -import platform - -if __name__ == "__main__": - - assert('python2_test.runfiles/python2/python2/bin/' in sys.executable) - assert(platform.python_version() == "2.7.18") diff --git a/examples/third_party/python/python_repositories.bzl b/examples/third_party/python/python_repositories.bzl index 2de32f5eb..69d54d364 100644 --- a/examples/third_party/python/python_repositories.bzl +++ b/examples/third_party/python/python_repositories.bzl @@ -5,16 +5,6 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") # buildifier: disable=unnamed-macro def python_repositories(): - maybe( - http_archive, - name = "python2", - build_file = Label("//python:BUILD.python2.bazel"), - strip_prefix = "Python-2.7.18", - urls = [ - "https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tgz", - ], - sha256 = "da3080e3b488f648a3d7a4560ddee895284c3380b11d6de75edb986526b9a814", - ) maybe( http_archive, name = "python3",