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 copybara-github committed Nov 25, 2020
1 parent de2dab0 commit 2d990cf
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 106 deletions.
31 changes: 4 additions & 27 deletions third_party/ijar/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -124,20 +124,6 @@ filegroup(

genrule(
name = "ijar_transitive_zip",
srcs = [
":ijar_srcs_zip",
":ijar_deploy_zip",
"//src:zlib_zip",
"//src/main/cpp/util:cpp_util_with_deps_zip",
],
outs = ["ijar_with_deps.zip"],
cmd = "$(location //src:merge_zip_files) - $@ $(SRCS)",
tools = ["//src:merge_zip_files"],
visibility = ["//visibility:public"],
)

genrule(
name = "ijar_transitive_srcs_zip",
srcs = [
":ijar_srcs_zip",
"//src:zlib_zip",
Expand All @@ -149,24 +135,15 @@ genrule(
visibility = ["//visibility:public"],
)

genrule(
name = "ijar_deploy_zip",
srcs = [
":ijar",
":zipper",
],
outs = ["ijar_deploy.zip"],
cmd = "$(location //src:zip_files) ijar $@ $(SRCS)",
tools = ["//src:zip_files"],
visibility = ["//visibility:public"],
)

genrule(
name = "ijar_srcs_zip",
srcs = glob(
["**"],
exclude = ["BUILD"],
),
) + [
":ijar",
":zipper",
],
outs = ["ijar_srcs.zip"],
cmd = "$(location //src:zip_files) ijar $@ $(SRCS)",
tools = ["//src:zip_files"],
Expand Down
21 changes: 10 additions & 11 deletions tools/android/BUILD.tools
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 2d990cf

Please sign in to comment.