|
10 | 10 | import shutil |
11 | 11 | import subprocess |
12 | 12 | import sys |
| 13 | +import sysconfig |
13 | 14 | import tempfile |
14 | 15 | import warnings |
15 | 16 |
|
16 | 17 | from venv import EnvBuilder |
17 | 18 |
|
| 19 | +import packaging.version |
18 | 20 | import pytest |
19 | 21 |
|
20 | 22 | import mesonpy |
@@ -77,13 +79,23 @@ def tmp_path_session(tmp_path_factory): |
77 | 79 | class VEnv(EnvBuilder): |
78 | 80 | def __init__(self, env_dir): |
79 | 81 | super().__init__(symlinks=True, with_pip=True) |
| 82 | + |
80 | 83 | # This warning is mistakenly generated by CPython 3.11.0 |
81 | 84 | # https://github.com/python/cpython/pull/98743 |
82 | 85 | with warnings.catch_warnings(): |
83 | 86 | if sys.version_info[:3] == (3, 11, 0): |
84 | 87 | warnings.filterwarnings('ignore', 'check_home argument is deprecated and ignored.', DeprecationWarning) |
85 | 88 | self.create(env_dir) |
86 | 89 |
|
| 90 | + # Free-threaded Python 3.13 requires pip 24.1b1 or later. |
| 91 | + if sysconfig.get_config_var('Py_GIL_DISABLED'): |
| 92 | + # importlib.metadata is not available on Python 3.7 and |
| 93 | + # earlier, however no-gil builds are available only for |
| 94 | + # Python 3.13 and later. |
| 95 | + import importlib.metadata |
| 96 | + if packaging.version.Version(importlib.metadata.version('pip')) < packaging.version.Version('24.1b1'): |
| 97 | + self.pip('install', '--upgrade', 'pip >= 24.1b1') |
| 98 | + |
87 | 99 | def ensure_directories(self, env_dir): |
88 | 100 | context = super().ensure_directories(env_dir) |
89 | 101 | # Store the path to the venv Python interpreter. There does |
|
0 commit comments