Skip to content

Commit c6441e5

Browse files
authored
refactor(venv): Move py_venv template files into a dedicated templates/ subdirectory (#1310)
This change reorganizes the `py_venv` template files by moving `_virtualenv.py`, `link.py`, `venv.tmpl.sh`, and `venv_activate.tmpl.sh` into a new templates/ subdirectory under py/private/py_venv. It also updates the corresponding Bazel references and test imports so everything still resolves correctly. --- ### Changes are visible to end-users: no ### Test plan - Covered by existing test cases
1 parent db6a180 commit c6441e5

7 files changed

Lines changed: 10 additions & 10 deletions

File tree

py/private/py_venv/BUILD.bazel

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
44
package(default_visibility = ["//py:__subpackages__"])
55

66
exports_files([
7-
"_virtualenv.py",
8-
"link.py",
9-
"venv.tmpl.sh",
10-
"venv_activate.tmpl.sh",
7+
"templates/_virtualenv.py",
8+
"templates/link.py",
9+
"templates/venv.tmpl.sh",
10+
"templates/venv_activate.tmpl.sh",
1111
])
1212

1313
bool_flag(

py/private/py_venv/py_venv.bzl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,11 @@ does not reinsert a wheel.
225225
# Shared with py_binary via the venv-assembly helper.
226226
"_venv_activate_tmpl": attr.label(
227227
allow_single_file = True,
228-
default = ":venv_activate.tmpl.sh",
228+
default = "//py/private/py_venv:templates/venv_activate.tmpl.sh",
229229
),
230230
"_virtualenv_shim": attr.label(
231231
allow_single_file = True,
232-
default = ":_virtualenv.py",
232+
default = "//py/private/py_venv:templates/_virtualenv.py",
233233
),
234234
"_windows_constraint": attr.label(
235235
default = "@platforms//os:windows",
@@ -270,7 +270,7 @@ environment. Forwarded to the sibling py_binary/py_test consumer
270270
),
271271
"_run_tmpl": attr.label(
272272
allow_single_file = True,
273-
default = ":venv.tmpl.sh",
273+
default = "//py/private/py_venv:templates/venv.tmpl.sh",
274274
),
275275
})
276276

@@ -476,7 +476,7 @@ def py_venv_link(name, venv, link_name = None, **kwargs):
476476
target's package + venv name.
477477
**kwargs: Forwarded to the underlying `py_binary`.
478478
"""
479-
link_script = str(Label(":link.py"))
479+
link_script = str(Label("//py/private/py_venv:templates/link.py"))
480480
_py_venv_exec(
481481
name = name,
482482
main = link_script,
File renamed without changes.
File renamed without changes.

py/private/py_venv/tests/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ write_source_files(
6565
py_test(
6666
name = "test_link",
6767
srcs = [
68-
"//py/private/py_venv:link.py",
68+
"//py/private/py_venv:templates/link.py",
6969
"//py/private/py_venv/tests:test_link.py",
7070
],
71-
imports = [".."],
71+
imports = ["../templates"],
7272
main = "//py/private/py_venv/tests:test_link.py",
7373
)

0 commit comments

Comments
 (0)