Skip to content

Commit 2980c17

Browse files
philwokatre
authored andcommitted
Fix #10127: Remove Python 2 dependency from tools/android.
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
1 parent c4975ef commit 2980c17

File tree

6 files changed

+14
-79
lines changed

6 files changed

+14
-79
lines changed

tools/android/BUILD.tools

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
load("//tools/python:private/defs.bzl", "py_binary", "py_library")
2-
load("//tools/python:private/version.bzl", "PY_BINARY_VERSION")
32
load(":defs.bzl", "run_ijar", "run_singlejar")
43

54
package(default_visibility = ["//visibility:public"])
@@ -269,21 +268,21 @@ alias(
269268
py_binary(
270269
name = "instrumentation_test_check",
271270
srcs = ["instrumentation_test_check.py"],
272-
python_version = PY_BINARY_VERSION,
271+
python_version = "PY3",
273272
deps = ["//third_party/py/abseil"],
274273
)
275274

276275
py_binary(
277276
name = "build_incremental_dexmanifest",
278277
srcs = [":build_incremental_dexmanifest.py"],
279-
python_version = PY_BINARY_VERSION,
278+
python_version = "PY3",
280279
deps = [],
281280
)
282281

283282
py_binary(
284283
name = "build_split_manifest",
285284
srcs = ["build_split_manifest.py"],
286-
python_version = PY_BINARY_VERSION,
285+
python_version = "PY3",
287286
deps = [
288287
"//third_party/py/abseil",
289288
],
@@ -292,7 +291,7 @@ py_binary(
292291
py_binary(
293292
name = "incremental_install",
294293
srcs = ["incremental_install.py"],
295-
python_version = PY_BINARY_VERSION,
294+
python_version = "PY3",
296295
deps = [
297296
"//third_party/py/abseil",
298297
"//third_party/py/concurrent:futures",
@@ -302,7 +301,7 @@ py_binary(
302301
py_binary(
303302
name = "strip_resources",
304303
srcs = ["strip_resources.py"],
305-
python_version = PY_BINARY_VERSION,
304+
python_version = "PY3",
306305
deps = [
307306
"//third_party/py/abseil",
308307
],
@@ -313,7 +312,7 @@ py_binary(
313312
srcs = [
314313
"aar_native_libs_zip_creator.py",
315314
],
316-
python_version = PY_BINARY_VERSION,
315+
python_version = "PY3",
317316
deps = [
318317
":junction_lib",
319318
"//third_party/py/abseil",
@@ -323,7 +322,7 @@ py_binary(
323322
py_binary(
324323
name = "stubify_manifest",
325324
srcs = ["stubify_manifest.py"],
326-
python_version = PY_BINARY_VERSION,
325+
python_version = "PY3",
327326
deps = [
328327
"//third_party/py/abseil",
329328
],
@@ -332,7 +331,7 @@ py_binary(
332331
py_binary(
333332
name = "aar_embedded_jars_extractor",
334333
srcs = ["aar_embedded_jars_extractor.py"],
335-
python_version = PY_BINARY_VERSION,
334+
python_version = "PY3",
336335
deps = [
337336
":junction_lib",
338337
"//third_party/py/abseil",
@@ -342,7 +341,7 @@ py_binary(
342341
py_binary(
343342
name = "aar_resources_extractor",
344343
srcs = ["aar_resources_extractor.py"],
345-
python_version = PY_BINARY_VERSION,
344+
python_version = "PY3",
346345
deps = [
347346
":junction_lib",
348347
"//third_party/py/abseil",
@@ -352,7 +351,7 @@ py_binary(
352351
py_binary(
353352
name = "resource_extractor",
354353
srcs = ["resource_extractor.py"],
355-
python_version = PY_BINARY_VERSION,
354+
python_version = "PY3",
356355
)
357356

358357
py_library(

tools/build_defs/pkg/BUILD

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
load("//tools/build_defs/pkg:pkg.bzl", "pkg_deb", "pkg_tar")
33
load("//tools/config:common_settings.bzl", "bool_flag")
44
load("//tools/python:private/defs.bzl", "py_binary", "py_library", "py_test")
5-
load("//tools/python:private/version.bzl", "PY_BINARY_VERSION")
65

76
licenses(["notice"]) # Apache 2.0
87

@@ -43,7 +42,7 @@ py_test(
4342
"testenv.py",
4443
],
4544
data = [":archive_testdata"],
46-
python_version = PY_BINARY_VERSION,
45+
python_version = "PY3",
4746
srcs_version = "PY2AND3",
4847
tags = [
4948
# archive.py requires xzcat, which is not available by default on Mac
@@ -64,7 +63,7 @@ py_test(
6463
py_binary(
6564
name = "build_tar",
6665
srcs = ["build_tar.py"],
67-
python_version = PY_BINARY_VERSION,
66+
python_version = "PY3",
6867
srcs_version = "PY2AND3",
6968
visibility = ["//visibility:public"],
7069
deps = [
@@ -79,7 +78,7 @@ py_binary(
7978
deprecation = "The internal version of make_deb is deprecated. Please " +
8079
"use the replacement for pkg_deb from " +
8180
"https://github.com/bazelbuild/rules_pkg/blob/master/pkg.",
82-
python_version = PY_BINARY_VERSION,
81+
python_version = "PY3",
8382
srcs_version = "PY2AND3",
8483
visibility = ["//visibility:public"],
8584
deps = [

tools/python/BUILD

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ filegroup(
1212

1313
filegroup(
1414
name = "embedded_tools",
15-
srcs = glob(
16-
["**"],
17-
exclude = ["private/version.bzl"],
18-
) + [
15+
srcs = glob(["**"]) + [
1916
"//tools/python/runfiles:embedded_tools",
2017
],
2118
visibility = ["//tools:__pkg__"],

tools/python/BUILD.tools

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ exports_files([
5454
"utils.bzl",
5555
"private/defs.bzl",
5656
"private/py_test_alias.bzl",
57-
"private/version.bzl",
5857
# write_file.bzl fortunately doesn't need to be exposed because it's only
5958
# used in this BUILD file.
6059
])
@@ -64,7 +63,6 @@ filegroup(
6463
srcs = glob(["*.bzl"]) + [
6564
"private/defs.bzl",
6665
"private/py_test_alias.bzl",
67-
"private/version.bzl",
6866
],
6967
visibility = ["//tools:__pkg__"],
7068
)

tools/python/private/version.bzl

Lines changed: 0 additions & 28 deletions
This file was deleted.

tools/python/private/version.bzl.tools

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)