Skip to content

Commit 3869174

Browse files
committed
rename to rules_python_extract_root
1 parent 0737858 commit 3869174

File tree

4 files changed

+20
-11
lines changed

4 files changed

+20
-11
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ Values:
227227
runtime.
228228

229229
:::{seealso}
230-
{envvar}`RULES_PYTHON_VENVS_ROOT` for customizing where the runtime venv
230+
{envvar}`RULES_PYTHON_EXTRACT_ROOT` for customizing where the runtime venv
231231
is created.
232232
:::
233233

docs/environment-variables.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,22 @@ When `1`, debug information about coverage behavior is printed to stderr.
6969
When `1`, debug information from gazelle is printed to stderr.
7070
:::
7171

72-
:::{envvar} RULES_PYTHON_VENVS_ROOT
72+
:::{envvar} RULES_PYTHON_EXTRACT_ROOT
7373

74-
Directory to use as the root for creating venvs for binaries. Only applicable
75-
when {obj}`--relative_venvs_symlinks=no` is used. A binary will attempt to
76-
find a unique, reusable, location for itself within this directory. When set,
77-
the created venv is not deleted upon program exit; it is the responsibility of
78-
the caller to manage cleanup.
74+
Directory to use as the root for creating files necessary for bootstrapping so
75+
that a binary can run.
76+
77+
Only applicable when {obj}`--venvs_use_declare_symlink=no` is used.
78+
79+
When set, a binary will attempt to find a unique, reusable, location within this
80+
directory for the files it needs to create to aid startup. The files may not be
81+
deleted upon program exit; it is the responsibility of the caller to ensure
82+
cleanup.
83+
84+
Manually specifying the directory is useful to lower the overhead of
85+
extracting/creating files on every program execution. By using a location
86+
outside /tmp, longer lived programs don't have to worry about files in /tmp
87+
being cleaned up by the OS.
7988

8089
If not set, then a temporary directory will be created and deleted upon program
8190
exit.

python/private/stage1_bootstrap_template.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,12 @@ if [[ "$IS_ZIPFILE" == "1" ]]; then
132132
mkdir -p "$(dirname $python_exe)"
133133
ln -s "$symlink_to" "$python_exe"
134134
elif [[ "$RECREATE_VENV_AT_RUNTIME" == "1" ]]; then
135-
if [[ -n "$RULES_PYTHON_VENVS_ROOT" ]]; then
135+
if [[ -n "$RULES_PYTHON_EXTRACT_ROOTT" ]]; then
136136
use_exec=1
137137
# Use our runfiles path as a unique, reusable, location for the
138138
# binary-specific venv being created.
139-
venv="$RULES_PYTHON_VENVS_ROOT/$(dirname $(dirname $PYTHON_BINARY))"
140-
mkdir -p $RULES_PYTHON_VENVS_ROOT
139+
venv="$RULES_PYTHON_EXTRACT_ROOTT/$(dirname $(dirname $PYTHON_BINARY))"
140+
mkdir -p $RULES_PYTHON_EXTRACT_ROOTT
141141
else
142142
# Re-exec'ing can't be used because we have to clean up the temporary
143143
# venv directory that is created.

tests/bootstrap_impls/run_binary_relative_venv_symlinks_no_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ expect_match "sys.executable:.*tmp.*python3" "$actual"
4949

5050
venvs_root=$(mkdir -d)
5151

52-
actual=$(RULES_PYTHON_VENVS_ROOT=$venvs_root $bin)
52+
actual=$(RULES_PYTHON_EXTRACT_ROOT=$venvs_root $bin)
5353
expect_match "sys.executable:.*$venvs_root" "$actual"
5454

5555
# Exit if any of the expects failed

0 commit comments

Comments
 (0)