Skip to content

Commit 7449c65

Browse files
authored
Merge branch 'main' into fix/2935-too-many-open-files
2 parents 905b15e + 858d5b8 commit 7449c65

File tree

8 files changed

+34
-9
lines changed

8 files changed

+34
-9
lines changed

.github/ISSUE_TEMPLATE/bug-report.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ Describe what's the expected behavior and what you're observing.
1515
Provide at least:
1616

1717
- OS:
18+
- Shell:
19+
- Python version and path:
1820
- `pip list` of the host python where `virtualenv` is installed:
1921

2022
```console

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ repos:
1515
- id: codespell
1616
args: ["--write-changes"]
1717
- repo: https://github.com/tox-dev/tox-ini-fmt
18-
rev: "1.5.0"
18+
rev: "1.6.0"
1919
hooks:
2020
- id: tox-ini-fmt
2121
args: ["-p", "fix"]
@@ -24,7 +24,7 @@ repos:
2424
hooks:
2525
- id: pyproject-fmt
2626
- repo: https://github.com/astral-sh/ruff-pre-commit
27-
rev: "v0.12.5"
27+
rev: "v0.12.7"
2828
hooks:
2929
- id: ruff-format
3030
- id: ruff

docs/changelog.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ Release History
55

66
.. towncrier release notes start
77
8+
v20.33.1 (2025-08-05)
9+
---------------------
10+
11+
Bugfixes - 20.33.1
12+
~~~~~~~~~~~~~~~~~~
13+
- Correctly unpack _get_tcl_tk_libs() response in PythonInfo.
14+
Contributed by :user:`esafak`. (:issue:`2930`)
15+
- Restore `py_info.py` timestamp in `test_py_info_cache_invalidation_on_py_info_change`
16+
Contributed by :user:`esafak`. (:issue:`2933`)
17+
818
v20.33.0 (2025-08-03)
919
---------------------
1020

src/virtualenv/activation/bash/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ def templates(self):
1212
def as_name(self, template):
1313
return Path(template).stem
1414

15+
def replacements(self, creator, dest):
16+
data = super().replacements(creator, dest)
17+
data.update({
18+
"__TCL_LIBRARY__": creator.interpreter.tcl_lib or "",
19+
"__TK_LIBRARY__": creator.interpreter.tk_lib or "",
20+
})
21+
return data
22+
1523

1624
__all__ = [
1725
"BashActivator",

src/virtualenv/activation/bash/activate.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,15 @@ if ! [ -z "${PYTHONHOME+_}" ] ; then
7979
unset PYTHONHOME
8080
fi
8181

82-
if [ __TCL_LIBRARY__ != "''" ]; then
82+
if [ __TCL_LIBRARY__ != "" ]; then
8383
if ! [ -z "${TCL_LIBRARY+_}" ] ; then
8484
_OLD_VIRTUAL_TCL_LIBRARY="$TCL_LIBRARY"
8585
fi
8686
TCL_LIBRARY=__TCL_LIBRARY__
8787
export TCL_LIBRARY
8888
fi
8989

90-
if [ __TK_LIBRARY__ != "''" ]; then
90+
if [ __TK_LIBRARY__ != "" ]; then
9191
if ! [ -z "${TK_LIBRARY+_}" ] ; then
9292
_OLD_VIRTUAL_TK_LIBRARY="$TK_LIBRARY"
9393
fi

src/virtualenv/discovery/py_info.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,10 @@ def abs_path(v):
123123

124124
self.sysconfig_vars = {i: sysconfig.get_config_var(i or "") for i in config_var_keys}
125125

126-
self.tcl_lib, self.tk_lib = self._get_tcl_tk_libs() if "TCL_LIBRARY" in os.environ else None, None
126+
if "TCL_LIBRARY" in os.environ:
127+
self.tcl_lib, self.tk_lib = self._get_tcl_tk_libs()
128+
else:
129+
self.tcl_lib, self.tk_lib = None, None
127130

128131
confs = {
129132
k: (self.system_prefix if v is not None and v.startswith(self.prefix) else v)

tests/unit/activation/test_bash.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,16 @@ def __init__(self, dest):
4848
assert "unset _OLD_VIRTUAL_TK_LIBRARY" in content
4949

5050
if present:
51-
assert "if [ /path/to/tcl != \"''\" ]; then" in content
51+
assert 'if [ /path/to/tcl != "" ]; then' in content
5252
assert "TCL_LIBRARY=/path/to/tcl" in content
5353
assert "export TCL_LIBRARY" in content
5454

55-
assert "if [ /path/to/tk != \"''\" ]; then" in content
55+
assert 'if [ /path/to/tk != "" ]; then' in content
5656
assert "TK_LIBRARY=/path/to/tk" in content
5757
assert "export TK_LIBRARY" in content
5858
else:
5959
# When not present, the if condition is false, so the block is not executed
60-
assert "if [ '' != \"''\" ]; then" in content
60+
assert "if [ '' != \"\" ]; then" in content, content
6161
assert "TCL_LIBRARY=''" in content
6262
# The export is inside the if, so this is fine
6363
assert "export TCL_LIBRARY" in content

tests/unit/discovery/py_info/test_py_info.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ def test_py_info_cache_invalidation_on_py_info_change(mocker, session_app_data):
165165
# 3. Modify the content of py_info.py
166166
py_info_script = Path(cached_py_info.__file__).parent / "py_info.py"
167167
original_content = py_info_script.read_text(encoding="utf-8")
168+
original_stat = py_info_script.stat()
168169

169170
try:
170171
# 4. Clear the in-memory cache
@@ -181,8 +182,9 @@ def test_py_info_cache_invalidation_on_py_info_change(mocker, session_app_data):
181182
assert spy.call_count == 2
182183

183184
finally:
184-
# Restore the original content
185+
# Restore the original content and timestamp
185186
py_info_script.write_text(original_content, encoding="utf-8")
187+
os.utime(str(py_info_script), (original_stat.st_atime, original_stat.st_mtime))
186188

187189

188190
@pytest.mark.skipif(not fs_supports_symlink(), reason="symlink is not supported")

0 commit comments

Comments
 (0)