Skip to content

Commit

Permalink
Fix bazelbuild#10127: Remove Python 2 dependency from tools/android.
Browse files Browse the repository at this point in the history
A couple of files still specified PY2 as their python_version. This
fails on modern systems that do not ship Python 2 anymore, or at least
do not install it by default (like Ubuntu 20.04).

PiperOrigin-RevId: 344244485
  • Loading branch information
philwo authored and katre committed Jul 13, 2021
1 parent 28739ad commit 19491a9
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 79 deletions.
21 changes: 10 additions & 11 deletions tools/android/BUILD.tools
@@ -1,5 +1,4 @@
load("//tools/python:private/defs.bzl", "py_binary", "py_library")
load("//tools/python:private/version.bzl", "PY_BINARY_VERSION")
load(":defs.bzl", "run_ijar", "run_singlejar")

package(default_visibility = ["//visibility:public"])
Expand Down Expand Up @@ -269,21 +268,21 @@ alias(
py_binary(
name = "instrumentation_test_check",
srcs = ["instrumentation_test_check.py"],
python_version = PY_BINARY_VERSION,
python_version = "PY3",
deps = ["//third_party/py/abseil"],
)

py_binary(
name = "build_incremental_dexmanifest",
srcs = [":build_incremental_dexmanifest.py"],
python_version = PY_BINARY_VERSION,
python_version = "PY3",
deps = [],
)

py_binary(
name = "build_split_manifest",
srcs = ["build_split_manifest.py"],
python_version = PY_BINARY_VERSION,
python_version = "PY3",
deps = [
"//third_party/py/abseil",
],
Expand All @@ -292,7 +291,7 @@ py_binary(
py_binary(
name = "incremental_install",
srcs = ["incremental_install.py"],
python_version = PY_BINARY_VERSION,
python_version = "PY3",
deps = [
"//third_party/py/abseil",
"//third_party/py/concurrent:futures",
Expand All @@ -302,7 +301,7 @@ py_binary(
py_binary(
name = "strip_resources",
srcs = ["strip_resources.py"],
python_version = PY_BINARY_VERSION,
python_version = "PY3",
deps = [
"//third_party/py/abseil",
],
Expand All @@ -313,7 +312,7 @@ py_binary(
srcs = [
"aar_native_libs_zip_creator.py",
],
python_version = PY_BINARY_VERSION,
python_version = "PY3",
deps = [
":junction_lib",
"//third_party/py/abseil",
Expand All @@ -323,7 +322,7 @@ py_binary(
py_binary(
name = "stubify_manifest",
srcs = ["stubify_manifest.py"],
python_version = PY_BINARY_VERSION,
python_version = "PY3",
deps = [
"//third_party/py/abseil",
],
Expand All @@ -332,7 +331,7 @@ py_binary(
py_binary(
name = "aar_embedded_jars_extractor",
srcs = ["aar_embedded_jars_extractor.py"],
python_version = PY_BINARY_VERSION,
python_version = "PY3",
deps = [
":junction_lib",
"//third_party/py/abseil",
Expand All @@ -342,7 +341,7 @@ py_binary(
py_binary(
name = "aar_resources_extractor",
srcs = ["aar_resources_extractor.py"],
python_version = PY_BINARY_VERSION,
python_version = "PY3",
deps = [
":junction_lib",
"//third_party/py/abseil",
Expand All @@ -352,7 +351,7 @@ py_binary(
py_binary(
name = "resource_extractor",
srcs = ["resource_extractor.py"],
python_version = PY_BINARY_VERSION,
python_version = "PY3",
)

py_library(
Expand Down
7 changes: 3 additions & 4 deletions tools/build_defs/pkg/BUILD
Expand Up @@ -2,7 +2,6 @@
load("//tools/build_defs/pkg:pkg.bzl", "pkg_deb", "pkg_tar")
load("//tools/config:common_settings.bzl", "bool_flag")
load("//tools/python:private/defs.bzl", "py_binary", "py_library", "py_test")
load("//tools/python:private/version.bzl", "PY_BINARY_VERSION")

licenses(["notice"]) # Apache 2.0

Expand Down Expand Up @@ -43,7 +42,7 @@ py_test(
"testenv.py",
],
data = [":archive_testdata"],
python_version = PY_BINARY_VERSION,
python_version = "PY3",
srcs_version = "PY2AND3",
tags = [
# archive.py requires xzcat, which is not available by default on Mac
Expand All @@ -64,7 +63,7 @@ py_test(
py_binary(
name = "build_tar",
srcs = ["build_tar.py"],
python_version = PY_BINARY_VERSION,
python_version = "PY3",
srcs_version = "PY2AND3",
visibility = ["//visibility:public"],
deps = [
Expand All @@ -79,7 +78,7 @@ py_binary(
deprecation = "The internal version of make_deb is deprecated. Please " +
"use the replacement for pkg_deb from " +
"https://github.com/bazelbuild/rules_pkg/blob/master/pkg.",
python_version = PY_BINARY_VERSION,
python_version = "PY3",
srcs_version = "PY2AND3",
visibility = ["//visibility:public"],
deps = [
Expand Down
5 changes: 1 addition & 4 deletions tools/python/BUILD
Expand Up @@ -12,10 +12,7 @@ filegroup(

filegroup(
name = "embedded_tools",
srcs = glob(
["**"],
exclude = ["private/version.bzl"],
) + [
srcs = glob(["**"]) + [
"//tools/python/runfiles:embedded_tools",
],
visibility = ["//tools:__pkg__"],
Expand Down
2 changes: 0 additions & 2 deletions tools/python/BUILD.tools
Expand Up @@ -54,7 +54,6 @@ exports_files([
"utils.bzl",
"private/defs.bzl",
"private/py_test_alias.bzl",
"private/version.bzl",
# write_file.bzl fortunately doesn't need to be exposed because it's only
# used in this BUILD file.
])
Expand All @@ -64,7 +63,6 @@ filegroup(
srcs = glob(["*.bzl"]) + [
"private/defs.bzl",
"private/py_test_alias.bzl",
"private/version.bzl",
],
visibility = ["//tools:__pkg__"],
)
Expand Down
28 changes: 0 additions & 28 deletions tools/python/private/version.bzl

This file was deleted.

30 changes: 0 additions & 30 deletions tools/python/private/version.bzl.tools

This file was deleted.

0 comments on commit 19491a9

Please sign in to comment.