Skip to content

Commit 3a1b9da

Browse files
authored
Merge branch 'main' into main
2 parents 22d401b + 90f51db commit 3a1b9da

24 files changed

+388
-243
lines changed

.github/workflows/ci.yml

Lines changed: 30 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ jobs:
2626
runs-on: ubuntu-latest
2727

2828
steps:
29-
- uses: actions/checkout@v2
30-
- uses: actions/setup-python@v2
29+
- uses: actions/checkout@v3
30+
- uses: actions/setup-python@v4
31+
with:
32+
python-version: "3.x"
3133
- run: pip install nox
3234
- run: nox -s docs
3335

@@ -60,8 +62,10 @@ jobs:
6062
runs-on: ubuntu-latest
6163

6264
steps:
63-
- uses: actions/checkout@v2
64-
- uses: actions/setup-python@v2
65+
- uses: actions/checkout@v3
66+
- uses: actions/setup-python@v4
67+
with:
68+
python-version: "3.x"
6569
- name: Set up git credentials
6670
run: |
6771
git config --global user.email "[email protected]"
@@ -82,8 +86,10 @@ jobs:
8286
github.event_name != 'pull_request'
8387
8488
steps:
85-
- uses: actions/checkout@v2
86-
- uses: actions/setup-python@v2
89+
- uses: actions/checkout@v3
90+
- uses: actions/setup-python@v4
91+
with:
92+
python-version: "3.x"
8793

8894
- run: pip install nox
8995
- run: nox -s vendoring
@@ -103,14 +109,15 @@ jobs:
103109
matrix:
104110
os: [Ubuntu, MacOS]
105111
python:
106-
- 3.7
107-
- 3.8
108-
- 3.9
112+
- "3.7"
113+
- "3.8"
114+
- "3.9"
109115
- "3.10"
116+
- "3.11"
110117

111118
steps:
112-
- uses: actions/checkout@v2
113-
- uses: actions/setup-python@v2
119+
- uses: actions/checkout@v3
120+
- uses: actions/setup-python@v4
114121
with:
115122
python-version: ${{ matrix.python }}
116123

@@ -120,9 +127,9 @@ jobs:
120127

121128
- name: Install MacOS dependencies
122129
if: matrix.os == 'MacOS'
123-
run: brew install bzr
130+
run: brew install breezy
124131

125-
- run: pip install nox 'virtualenv<20' 'setuptools != 60.6.0'
132+
- run: pip install nox
126133

127134
# Main check
128135
- name: Run unit tests
@@ -151,16 +158,17 @@ jobs:
151158
matrix:
152159
os: [Windows]
153160
python:
154-
- 3.7
161+
- "3.7"
155162
# Commented out, since Windows tests are expensively slow.
156-
# - 3.8
157-
# - 3.9
158-
- "3.10"
163+
# - "3.8"
164+
# - "3.9"
165+
# - "3.10"
166+
- "3.11"
159167
group: [1, 2]
160168

161169
steps:
162-
- uses: actions/checkout@v2
163-
- uses: actions/setup-python@v2
170+
- uses: actions/checkout@v3
171+
- uses: actions/setup-python@v4
164172
with:
165173
python-version: ${{ matrix.python }}
166174

@@ -179,7 +187,7 @@ jobs:
179187
$acl.AddAccessRule($rule)
180188
Set-Acl "R:\Temp" $acl
181189
182-
- run: pip install nox 'virtualenv<20'
190+
- run: pip install nox
183191
env:
184192
TEMP: "R:\\Temp"
185193

@@ -221,8 +229,8 @@ jobs:
221229
github.event_name != 'pull_request'
222230
223231
steps:
224-
- uses: actions/checkout@v2
225-
- uses: actions/setup-python@v2
232+
- uses: actions/checkout@v3
233+
- uses: actions/setup-python@v4
226234
with:
227235
python-version: "3.10"
228236

@@ -240,41 +248,6 @@ jobs:
240248
--durations=5
241249
--use-zipapp
242250
243-
# TODO: Remove this when we add Python 3.11 to CI.
244-
tests-importlib-metadata:
245-
name: tests for importlib.metadata backend
246-
runs-on: ubuntu-latest
247-
env:
248-
_PIP_USE_IMPORTLIB_METADATA: 'true'
249-
250-
needs: [packaging, determine-changes]
251-
if: >-
252-
needs.determine-changes.outputs.tests == 'true' ||
253-
github.event_name != 'pull_request'
254-
255-
steps:
256-
- uses: actions/checkout@v2
257-
- uses: actions/setup-python@v2
258-
with:
259-
python-version: '3.10'
260-
261-
- name: Install Ubuntu dependencies
262-
run: sudo apt-get install bzr
263-
264-
- run: pip install nox 'virtualenv<20'
265-
266-
- name: Run unit tests
267-
run: >-
268-
nox -s test-3.10 --
269-
-m unit
270-
--verbose --numprocesses auto --showlocals
271-
- name: Run integration tests
272-
run: >-
273-
nox -s test-3.10 --
274-
-m integration
275-
--verbose --numprocesses auto --showlocals
276-
--durations=5
277-
278251
check: # This job does nothing and is only used for the branch protection
279252
if: always()
280253

@@ -285,7 +258,6 @@ jobs:
285258
- tests-unix
286259
- tests-windows
287260
- tests-zipapp
288-
- tests-importlib-metadata
289261
- vendoring
290262

291263
runs-on: ubuntu-latest

.github/workflows/news-file.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-20.04
1111

1212
steps:
13-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v3
1414
with:
1515
# `towncrier check` runs `git diff --name-only origin/main...`, which
1616
# needs a non-shallow clone.

NEWS.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@
99
1010
.. towncrier release notes start
1111
12+
22.3.1 (2022-11-05)
13+
===================
14+
15+
Bug Fixes
16+
---------
17+
18+
- Fix entry point generation of ``pip.X``, ``pipX.Y``, and ``easy_install-X.Y``
19+
to correctly account for multi-digit Python version segments (e.g. the "11"
20+
part of 3.11). (`#11547 <https://github.com/pypa/pip/issues/11547>`_)
21+
22+
1223
22.3 (2022-10-15)
1324
=================
1425

docs/html/development/release-process.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ their merits.
6565
``pip._internal.utils.deprecation.deprecated``. The function is not a part of
6666
pip's public API.
6767

68+
Supported Versions
69+
==================
70+
71+
The latest version of the pip is the only supported version, previous
72+
versions should be considered unsupported. Users are encouraged to make
73+
regular updates to their version of pip in order to remain supported.
74+
6875
.. _`Python 2 Support`:
6976

7077
Python 2 Support

news/11547.bugfix.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fix entry point generation of ``pip.X``, ``pipX.Y``, and ``easy_install-X.Y``
2+
to correctly account for multi-digit Python version segments (e.g. the "11"
3+
part of 3.11).

noxfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def should_update_common_wheels() -> bool:
6666
# -----------------------------------------------------------------------------
6767
# Development Commands
6868
# -----------------------------------------------------------------------------
69-
@nox.session(python=["3.7", "3.8", "3.9", "3.10", "pypy3"])
69+
@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11", "pypy3"])
7070
def test(session: nox.Session) -> None:
7171
# Get the common wheels.
7272
if should_update_common_wheels():

setup.cfg

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ xfail_strict = True
6363
markers =
6464
network: tests that need network
6565
incompatible_with_sysconfig
66-
incompatible_with_test_venv
6766
incompatible_with_venv
6867
no_auto_tempdir_manager
6968
unit: unit tests

src/pip/_internal/operations/install/wheel.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ def get_console_script_specs(console: Dict[str, str]) -> List[str]:
325325

326326
scripts_to_generate.append(f"pip{get_major_minor_version()} = {pip_script}")
327327
# Delete any other versioned pip entry points
328-
pip_ep = [k for k in console if re.match(r"pip(\d(\.\d)?)?$", k)]
328+
pip_ep = [k for k in console if re.match(r"pip(\d+(\.\d+)?)?$", k)]
329329
for k in pip_ep:
330330
del console[k]
331331
easy_install_script = console.pop("easy_install", None)
@@ -340,7 +340,7 @@ def get_console_script_specs(console: Dict[str, str]) -> List[str]:
340340
)
341341
# Delete any other versioned easy_install entry points
342342
easy_install_ep = [
343-
k for k in console if re.match(r"easy_install(-\d\.\d)?$", k)
343+
k for k in console if re.match(r"easy_install(-\d+\.\d+)?$", k)
344344
]
345345
for k in easy_install_ep:
346346
del console[k]

src/pip/_internal/utils/virtualenv.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def _running_under_venv() -> bool:
1919
return sys.prefix != getattr(sys, "base_prefix", sys.prefix)
2020

2121

22-
def _running_under_regular_virtualenv() -> bool:
22+
def _running_under_legacy_virtualenv() -> bool:
2323
"""Checks if sys.real_prefix is set.
2424
2525
This handles virtual environments created with pypa's virtualenv.
@@ -29,8 +29,8 @@ def _running_under_regular_virtualenv() -> bool:
2929

3030

3131
def running_under_virtualenv() -> bool:
32-
"""Return True if we're running inside a virtualenv, False otherwise."""
33-
return _running_under_venv() or _running_under_regular_virtualenv()
32+
"""True if we're running inside a virtual environment, False otherwise."""
33+
return _running_under_venv() or _running_under_legacy_virtualenv()
3434

3535

3636
def _get_pyvenv_cfg_lines() -> Optional[List[str]]:
@@ -77,7 +77,7 @@ def _no_global_under_venv() -> bool:
7777
return False
7878

7979

80-
def _no_global_under_regular_virtualenv() -> bool:
80+
def _no_global_under_legacy_virtualenv() -> bool:
8181
"""Check if "no-global-site-packages.txt" exists beside site.py
8282
8383
This mirrors logic in pypa/virtualenv for determining whether system
@@ -98,7 +98,7 @@ def virtualenv_no_global() -> bool:
9898
if _running_under_venv():
9999
return _no_global_under_venv()
100100

101-
if _running_under_regular_virtualenv():
102-
return _no_global_under_regular_virtualenv()
101+
if _running_under_legacy_virtualenv():
102+
return _no_global_under_legacy_virtualenv()
103103

104104
return False

tests/conftest.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,6 @@ def pytest_collection_modifyitems(config: Config, items: List[pytest.Function])
108108
if item.get_closest_marker("network") is not None:
109109
item.add_marker(pytest.mark.flaky(reruns=3, reruns_delay=2))
110110

111-
if item.get_closest_marker("incompatible_with_test_venv") and config.getoption(
112-
"--use-venv"
113-
):
114-
item.add_marker(pytest.mark.skip("Incompatible with test venv"))
115111
if (
116112
item.get_closest_marker("incompatible_with_venv")
117113
and sys.prefix != sys.base_prefix
@@ -474,9 +470,6 @@ def virtualenv_template(
474470
):
475471
(venv.bin / exe).unlink()
476472

477-
# Enable user site packages.
478-
venv.user_site_packages = True
479-
480473
# Rename original virtualenv directory to make sure
481474
# it's not reused by mistake from one of the copies.
482475
venv_template = tmpdir / "venv_template"
@@ -742,3 +735,8 @@ def mock_server() -> Iterator[MockServer]:
742735
@pytest.fixture
743736
def proxy(request: pytest.FixtureRequest) -> str:
744737
return request.config.getoption("proxy")
738+
739+
740+
@pytest.fixture
741+
def enable_user_site(virtualenv: VirtualEnvironment) -> None:
742+
virtualenv.user_site_packages = True

tests/functional/test_build_env.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def test_build_env_overlay_prefix_has_priority(script: PipTestEnvironment) -> No
204204
assert result.stdout.strip() == "2.0", str(result)
205205

206206

207-
@pytest.mark.incompatible_with_test_venv
207+
@pytest.mark.usefixtures("enable_user_site")
208208
def test_build_env_isolation(script: PipTestEnvironment) -> None:
209209

210210
# Create dummy `pkg` wheel.

tests/functional/test_freeze.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,7 @@ def test_freeze_with_requirement_option_package_repeated_multi_file(
862862

863863

864864
@pytest.mark.network
865-
@pytest.mark.incompatible_with_test_venv
865+
@pytest.mark.usefixtures("enable_user_site")
866866
def test_freeze_user(
867867
script: PipTestEnvironment, virtualenv: VirtualEnvironment, data: TestData
868868
) -> None:
@@ -900,7 +900,7 @@ def test_freeze_path(tmpdir: Path, script: PipTestEnvironment, data: TestData) -
900900

901901

902902
@pytest.mark.network
903-
@pytest.mark.incompatible_with_test_venv
903+
@pytest.mark.usefixtures("enable_user_site")
904904
def test_freeze_path_exclude_user(
905905
tmpdir: Path, script: PipTestEnvironment, data: TestData
906906
) -> None:

0 commit comments

Comments
 (0)