You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.3 KiB
63 lines
1.3 KiB
load("@rules_python//python:defs.bzl", "py_binary")
|
|
load("@rules_python//python:defs.bzl", "py_runtime_pair")
|
|
load("@pip_requirements//:requirements.bzl", "requirement")
|
|
|
|
load("//:build_settings.bzl", "flavor")
|
|
|
|
py_runtime(
|
|
name = "python37",
|
|
interpreter_path = "/usr/local/bin/python3.7",
|
|
python_version = "PY3"
|
|
)
|
|
|
|
py_runtime(
|
|
name = "python38",
|
|
interpreter_path = "/usr/local/bin/python3.8",
|
|
python_version = "PY3"
|
|
)
|
|
|
|
py_runtime_pair(
|
|
name = "py_runtime_pair",
|
|
py3_runtime = ":python37",
|
|
# py3_runtime = ":python38",
|
|
)
|
|
|
|
toolchain(
|
|
name = "python_toolchain",
|
|
toolchain = ":py_runtime_pair",
|
|
toolchain_type = "@rules_python//python:toolchain_type",
|
|
)
|
|
|
|
flavor(
|
|
name = "favorite_flavor",
|
|
build_setting_default = "ORANGE"
|
|
)
|
|
|
|
config_setting(
|
|
name = "apple_flavor_setting",
|
|
flag_values = {
|
|
":favorite_flavor": "APPLE"
|
|
},
|
|
)
|
|
|
|
config_setting(
|
|
name = "banana_flavor_setting",
|
|
flag_values = {
|
|
":favorite_flavor": "BANANA"
|
|
},
|
|
)
|
|
|
|
py_binary(
|
|
name = "main",
|
|
srcs = ["main.py"],
|
|
args = select({
|
|
":apple_flavor_setting": ["--red", "--green"],
|
|
":banana_flavor_setting": ["--brown", "--curved=true"],
|
|
"//conditions:default": ["--orange"],
|
|
}),
|
|
srcs_version = "PY3",
|
|
deps = [
|
|
requirement("pyyaml"),
|
|
requirement("flask"),
|
|
],
|
|
)
|
|
|