Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

use python_version = PY2 for par_binary and py_binary targets #787

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2017 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Flags to explicitly use python toolchains to select appropriate py_runtime
# Also, force host binaries to use py2.
# Note these flags will only work with Bazel 0.25.0 or above.
build --incompatible_use_python_toolchains
build --host_force_python=PY2
test --incompatible_use_python_toolchains
test --host_force_python=PY2
run --incompatible_use_python_toolchains
run --host_force_python=PY2
4 changes: 4 additions & 0 deletions container/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ py_binary(
name = "extract_config",
srcs = ["extract_config.py"],
legacy_create_init = False,
python_version = "PY2",
visibility = ["//visibility:public"],
deps = [
"@containerregistry",
Expand All @@ -48,6 +49,7 @@ py_binary(
name = "join_layers",
srcs = ["join_layers.py"],
legacy_create_init = False,
python_version = "PY2",
visibility = ["//visibility:public"],
deps = [
":utils",
Expand All @@ -60,6 +62,7 @@ py_binary(
name = "create_image_config",
srcs = ["create_image_config.py"],
legacy_create_init = False,
python_version = "PY2",
visibility = ["//visibility:public"],
deps = [
":utils",
Expand Down Expand Up @@ -167,6 +170,7 @@ py_test(
size = "medium",
srcs = ["image_test.py"],
data = TEST_DATA,
python_version = "PY2",
deps = ["@containerregistry"],
)

Expand Down
1 change: 1 addition & 0 deletions python/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ py_runtime(
files = [],
interpreter_path = "/usr/bin/python2",
)

1 change: 1 addition & 0 deletions tests/container/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ package(default_visibility = ["//visibility:public"])
py_test(
name = "build_tar_test",
srcs = ["build_tar_test.py"],
python_version = "PY2",
deps = ["//container:build_tar_lib"],
)
1 change: 1 addition & 0 deletions tools/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ py_binary(
name = "update_deps",
srcs = ["update_deps.py"],
legacy_create_init = False,
python_version = "PY2",
deps = [
"@containerregistry",
],
Expand Down