Skip to content

Commit

Permalink
use python_version = PY2 for par_binary and py_binary targets
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Lopez committed Apr 5, 2019
1 parent 29ae85e commit 3b3be50
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
build --python_top=//python:default_py_runtime
build --host_force_python=PY2
test --python_top=//python:default_py_runtime
test --host_force_python=PY2
run --python_top=//python:default_py_runtime
run --host_force_python=PY2
3 changes: 3 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
12 changes: 12 additions & 0 deletions python/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,15 @@ py_runtime(
files = [],
interpreter_path = "/usr/bin/python2",
)

# Starting with Bazel 0.25.0 we must pass a py_runtime that points
# to valid python2 and python3 tools.
py_runtime(
name = "default_py_runtime",
interpreter_path = select({
# Update paths as appropriate for your system.
"@bazel_tools//tools/python:PY2": "/usr/bin/python2",
"@bazel_tools//tools/python:PY3": "/usr/bin/python3",
}),
files = [],
)
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

0 comments on commit 3b3be50

Please sign in to comment.