Skip to content

Commit 7982332

Browse files
committed
use empty string for repo env due to bazel 7
1 parent c81a020 commit 7982332

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

python/private/runtime_env_repo.bzl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ def _runtime_env_repo_impl(rctx):
1010
op = "GetPyenvVersionFile",
1111
arguments = [pyenv, "version-file"],
1212
).stdout.strip()
13+
14+
# When pyenv is used, the version file is what decided the
15+
# version used. Watch it so we compute the correct value if the
16+
# user changes it.
1317
rctx.watch(pyenv_version_file)
1418

1519
version = repo_utils.execute_checked(
@@ -24,7 +28,9 @@ def _runtime_env_repo_impl(rctx):
2428
environment = {
2529
# Prevent the user's current shell from influencing the result.
2630
# This envvar won't be present when a test is run.
27-
"PYENV_VERSION": None,
31+
# NOTE: This should be None, but Bazel 7 doesn't support None
32+
# values. Thankfully, pyenv treats empty string the same as missing.
33+
"PYENV_VERSION": "",
2834
},
2935
).stdout.strip()
3036
rctx.file("info.bzl", "PYTHON_VERSION = '{}'\n".format(version))

0 commit comments

Comments
 (0)