Skip to content

Commit f0857da

Browse files
committed
rename to venvs_use_declare_symlink
1 parent 3869174 commit f0857da

File tree

10 files changed

+75
-76
lines changed

10 files changed

+75
-76
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Unreleased changes template.
7878
* (sphinxdocs) Do not crash when `tag_class` does not have a populated `doc` value.
7979
Fixes ([#2579](https://github.com/bazelbuild/rules_python/issues/2579)).
8080
* (binaries/tests) Fix packaging when using `--bootstrap_impl=script`: set
81-
{obj}`--relative_venv_symlinks=no` to have it avoid creating symlinks at
81+
{obj}`--venvs_use_declare_symlink=no` to have it avoid creating symlinks at
8282
build time.
8383
Fixes ([#2489](https://github.com/bazelbuild/rules_python/issues/2489)
8484

docs/api/rules_python/python/config_settings/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ Values:
212212
:::
213213
::::
214214

215-
::::{bzl:flag} relative_venv_symlinks
215+
::::{bzl:flag} venvs_use_declare_symlink
216216

217217
Determines if relative symlinks are created using `declare_symlink()` at build
218218
time.

docs/environment-variables.md

Lines changed: 47 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,9 @@
11
# Environment Variables
22

3-
:::{envvar} RULES_PYTHON_REPO_DEBUG
4-
5-
When `1`, repository rules will print debug information about what they're
6-
doing. This is mostly useful for development to debug errors.
7-
:::
8-
9-
:::{envvar} RULES_PYTHON_REPO_DEBUG_VERBOSITY
10-
11-
Determines the verbosity of logging output for repo rules. Valid values:
12-
13-
* `DEBUG`
14-
* `INFO`
15-
* `TRACE`
16-
:::
17-
18-
:::{envvar} RULES_PYTHON_REPO_TOOLCHAIN_VERSION_OS_ARCH
19-
20-
Determines the python interpreter platform to be used for a particular
21-
interpreter `(version, os, arch)` triple to be used in repository rules.
22-
Replace the `VERSION_OS_ARCH` part with actual values when using, e.g.
23-
`3_13_0_linux_x86_64`. The version values must have `_` instead of `.` and the
24-
os, arch values are the same as the ones mentioned in the
25-
`//python:versions.bzl` file.
26-
:::
27-
28-
:::{envvar} RULES_PYTHON_PIP_ISOLATED
29-
30-
Determines if `--isolated` is used with pip.
3+
:::{envvar} RULES_PYTHON_BOOTSTRAP_VERBOSE
314

32-
Valid values:
33-
* `0` and `false` mean to not use isolated mode
34-
* Other non-empty values mean to use isolated mode.
5+
When `1`, debug information about bootstrapping of a program is printed to
6+
stderr.
357
:::
368

379
:::{envvar} RULES_PYTHON_BZLMOD_DEBUG
@@ -52,23 +24,6 @@ When `1`, the rules_python Starlark implementation of the core rules is used
5224
instead of the Bazel-builtin rules. Note this requires Bazel 7+.
5325
:::
5426

55-
:::{envvar} RULES_PYTHON_BOOTSTRAP_VERBOSE
56-
57-
When `1`, debug information about bootstrapping of a program is printed to
58-
stderr.
59-
:::
60-
61-
:::{envvar} VERBOSE_COVERAGE
62-
63-
When `1`, debug information about coverage behavior is printed to stderr.
64-
:::
65-
66-
67-
:::{envvar} RULES_PYTHON_GAZELLE_VERBOSE
68-
69-
When `1`, debug information from gazelle is printed to stderr.
70-
:::
71-
7227
:::{envvar} RULES_PYTHON_EXTRACT_ROOT
7328

7429
Directory to use as the root for creating files necessary for bootstrapping so
@@ -89,3 +44,47 @@ being cleaned up by the OS.
8944
If not set, then a temporary directory will be created and deleted upon program
9045
exit.
9146
:::
47+
48+
:::{envvar} RULES_PYTHON_GAZELLE_VERBOSE
49+
50+
When `1`, debug information from gazelle is printed to stderr.
51+
:::
52+
53+
:::{envvar} RULES_PYTHON_PIP_ISOLATED
54+
55+
Determines if `--isolated` is used with pip.
56+
57+
Valid values:
58+
* `0` and `false` mean to not use isolated mode
59+
* Other non-empty values mean to use isolated mode.
60+
:::
61+
62+
:::{envvar} RULES_PYTHON_REPO_DEBUG
63+
64+
When `1`, repository rules will print debug information about what they're
65+
doing. This is mostly useful for development to debug errors.
66+
:::
67+
68+
:::{envvar} RULES_PYTHON_REPO_DEBUG_VERBOSITY
69+
70+
Determines the verbosity of logging output for repo rules. Valid values:
71+
72+
* `DEBUG`
73+
* `INFO`
74+
* `TRACE`
75+
:::
76+
77+
:::{envvar} RULES_PYTHON_REPO_TOOLCHAIN_VERSION_OS_ARCH
78+
79+
Determines the python interpreter platform to be used for a particular
80+
interpreter `(version, os, arch)` triple to be used in repository rules.
81+
Replace the `VERSION_OS_ARCH` part with actual values when using, e.g.
82+
`3_13_0_linux_x86_64`. The version values must have `_` instead of `.` and the
83+
os, arch values are the same as the ones mentioned in the
84+
`//python:versions.bzl` file.
85+
:::
86+
87+
:::{envvar} VERBOSE_COVERAGE
88+
89+
When `1`, debug information about coverage behavior is printed to stderr.
90+
:::

python/config_settings/BUILD.bazel

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ load(
99
"LibcFlag",
1010
"PrecompileFlag",
1111
"PrecompileSourceRetentionFlag",
12-
"RelativeVenvSymlinksFlag",
12+
"VenvsUseDeclareSymlinkFlag",
1313
)
1414
load(
1515
"//python/private/pypi:flags.bzl",
@@ -123,9 +123,9 @@ config_setting(
123123
)
124124

125125
string_flag(
126-
name = "relative_venv_symlinks",
127-
build_setting_default = RelativeVenvSymlinksFlag.YES,
128-
values = RelativeVenvSymlinksFlag.flag_values(),
126+
name = "venvs_use_declare_symlink",
127+
build_setting_default = VenvsUseDeclareSymlinkFlag.YES,
128+
values = VenvsUseDeclareSymlinkFlag.flag_values(),
129129
visibility = ["//visibility:public"],
130130
)
131131

python/private/flags.bzl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,19 +123,19 @@ PrecompileSourceRetentionFlag = enum(
123123
get_effective_value = _precompile_source_retention_flag_get_effective_value,
124124
)
125125

126-
def _relative_venv_symlinks_flag_get_value(ctx):
127-
return ctx.attr._relative_venv_symlinks_flag[BuildSettingInfo].value
126+
def _venvs_use_declare_symlink_flag_get_value(ctx):
127+
return ctx.attr._venvs_use_declare_symlink_flag[BuildSettingInfo].value
128128

129129
# Decides if the venv created by bootstrap=script uses declare_file() to
130130
# create relative symlinks. Workaround for #2489 (packaging rules not supporting
131131
# declare_link() files).
132132
# buildifier: disable=name-conventions
133-
RelativeVenvSymlinksFlag = FlagEnum(
133+
VenvsUseDeclareSymlinkFlag = FlagEnum(
134134
# Use declare_file() and relative symlinks in the venv
135135
YES = "yes",
136136
# Do not use declare_file() and relative symlinks in the venv
137137
NO = "no",
138-
get_value = _relative_venv_symlinks_flag_get_value,
138+
get_value = _venvs_use_declare_symlink_flag_get_value,
139139
)
140140

141141
# Used for matching freethreaded toolchains and would have to be used in wheels

python/private/py_executable.bzl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ load(
5151
"target_platform_has_any_constraint",
5252
"union_attrs",
5353
)
54-
load(":flags.bzl", "BootstrapImplFlag", "RelativeVenvSymlinksFlag")
54+
load(":flags.bzl", "BootstrapImplFlag", "VenvsUseDeclareSymlinkFlag")
5555
load(":precompile.bzl", "maybe_precompile")
5656
load(":py_cc_link_params_info.bzl", "PyCcLinkParamsInfo")
5757
load(":py_executable_info.bzl", "PyExecutableInfo")
@@ -195,8 +195,8 @@ accepting arbitrary Python versions.
195195
"_python_version_flag": attr.label(
196196
default = "//python/config_settings:python_version",
197197
),
198-
"_relative_venv_symlinks_flag": attr.label(
199-
default = "//python/config_settings:relative_venv_symlinks",
198+
"_venvs_use_declare_symlink_flag": attr.label(
199+
default = "//python/config_settings:venvs_use_declare_symlink",
200200
providers = [BuildSettingInfo],
201201
),
202202
"_windows_constraints": attr.label_list(
@@ -516,11 +516,11 @@ def _create_venv(ctx, output_prefix, imports, runtime_details):
516516
ctx.actions.write(pyvenv_cfg, "")
517517

518518
runtime = runtime_details.effective_runtime
519-
relative_venv_symlinks_enabled = (
520-
RelativeVenvSymlinksFlag.get_value(ctx) == RelativeVenvSymlinksFlag.YES
519+
venvs_use_declare_symlink_enabled = (
520+
VenvsUseDeclareSymlinkFlag.get_value(ctx) == VenvsUseDeclareSymlinkFlag.YES
521521
)
522522

523-
if not relative_venv_symlinks_enabled:
523+
if not venvs_use_declare_symlink_enabled:
524524
if runtime.interpreter:
525525
interpreter_actual_path = _runfiles_root_path(ctx, runtime.interpreter.short_path)
526526
else:
@@ -593,7 +593,7 @@ def _create_venv(ctx, output_prefix, imports, runtime_details):
593593

594594
return struct(
595595
interpreter = interpreter,
596-
recreate_venv_at_runtime = not relative_venv_symlinks_enabled,
596+
recreate_venv_at_runtime = not venvs_use_declare_symlink_enabled,
597597
# Runfiles root relative path or absolute path
598598
interpreter_actual_path = interpreter_actual_path,
599599
files_without_interpreter = [pyvenv_cfg, pth, site_init],

tests/bootstrap_impls/BUILD.bazel

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ sh_py_run_test(
6262
)
6363

6464
sh_py_run_test(
65-
name = "run_binary_relative_venv_symlinks_no_test",
65+
name = "run_binary_venvs_use_declare_symlink_no_test",
6666
bootstrap_impl = "script",
6767
py_src = "bin.py",
68-
relative_venv_symlinks = "no",
69-
sh_src = "run_binary_relative_venv_symlinks_no_test.sh",
68+
sh_src = "run_binary_venvs_use_declare_symlink_no_test.sh",
7069
target_compatible_with = SUPPORTS_BOOTSTRAP_SCRIPT,
70+
venvs_use_declare_symlink = "no",
7171
)
7272

7373
sh_py_run_test(

tests/packaging/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ py_reconfig_test(
3030
srcs = ["bin.py"],
3131
bootstrap_impl = "script",
3232
main = "bin.py",
33+
target_compatible_with = SUPPORTS_BOOTSTRAP_SCRIPT,
3334
# Needed until https://github.com/bazelbuild/rules_pkg/issues/929 is fixed
3435
# See: https://github.com/bazelbuild/rules_python/issues/2489
35-
relative_venv_symlinks = "no",
36-
target_compatible_with = SUPPORTS_BOOTSTRAP_SCRIPT,
36+
venvs_use_declare_symlink = "no",
3737
)
3838

3939
pkg_tar(

tests/support/sh_py_run_test.bzl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ def _perform_transition_impl(input_settings, attr):
3333
settings["//command_line_option:extra_toolchains"] = attr.extra_toolchains
3434
if attr.python_version:
3535
settings["//python/config_settings:python_version"] = attr.python_version
36-
if attr.relative_venv_symlinks:
37-
settings["//python/config_settings:relative_venv_symlinks"] = attr.relative_venv_symlinks
36+
if attr.venvs_use_declare_symlink:
37+
settings["//python/config_settings:venvs_use_declare_symlink"] = attr.venvs_use_declare_symlink
3838
return settings
3939

4040
_perform_transition = transition(
@@ -43,14 +43,14 @@ _perform_transition = transition(
4343
"//python/config_settings:bootstrap_impl",
4444
"//command_line_option:extra_toolchains",
4545
"//python/config_settings:python_version",
46-
"//python/config_settings:relative_venv_symlinks",
46+
"//python/config_settings:venvs_use_declare_symlink",
4747
],
4848
outputs = [
4949
"//command_line_option:build_python_zip",
5050
"//command_line_option:extra_toolchains",
5151
"//python/config_settings:bootstrap_impl",
5252
"//python/config_settings:python_version",
53-
"//python/config_settings:relative_venv_symlinks",
53+
"//python/config_settings:venvs_use_declare_symlink",
5454
VISIBLE_FOR_TESTING,
5555
],
5656
)
@@ -109,8 +109,8 @@ toolchain.
109109
""",
110110
),
111111
"python_version": attr.string(),
112-
"relative_venv_symlinks": attr.string(),
113112
"target": attr.label(executable = True, cfg = "target"),
113+
"venvs_use_declare_symlink": attr.string(),
114114
"_allowlist_function_transition": attr.label(
115115
default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
116116
),
@@ -133,7 +133,7 @@ def _py_reconfig_executable(*, name, py_reconfig_rule, py_inner_rule, **kwargs):
133133
"build_python_zip",
134134
"extra_toolchains",
135135
"python_version",
136-
"relative_venv_symlinks",
136+
"venvs_use_declare_symlink",
137137
]
138138
reconfig_kwargs = {
139139
key: kwargs.pop(key, None)

0 commit comments

Comments
 (0)