Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
uranusjr authored Nov 10, 2022
2 parents 22d401b + 90f51db commit 3a1b9da
Show file tree
Hide file tree
Showing 24 changed files with 388 additions and 243 deletions.
88 changes: 30 additions & 58 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- run: pip install nox
- run: nox -s docs

Expand Down Expand Up @@ -60,8 +62,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Set up git credentials
run: |
git config --global user.email "[email protected]"
Expand All @@ -82,8 +86,10 @@ jobs:
github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.x"

- run: pip install nox
- run: nox -s vendoring
Expand All @@ -103,14 +109,15 @@ jobs:
matrix:
os: [Ubuntu, MacOS]
python:
- 3.7
- 3.8
- 3.9
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

Expand All @@ -120,9 +127,9 @@ jobs:

- name: Install MacOS dependencies
if: matrix.os == 'MacOS'
run: brew install bzr
run: brew install breezy

- run: pip install nox 'virtualenv<20' 'setuptools != 60.6.0'
- run: pip install nox

# Main check
- name: Run unit tests
Expand Down Expand Up @@ -151,16 +158,17 @@ jobs:
matrix:
os: [Windows]
python:
- 3.7
- "3.7"
# Commented out, since Windows tests are expensively slow.
# - 3.8
# - 3.9
- "3.10"
# - "3.8"
# - "3.9"
# - "3.10"
- "3.11"
group: [1, 2]

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

Expand All @@ -179,7 +187,7 @@ jobs:
$acl.AddAccessRule($rule)
Set-Acl "R:\Temp" $acl
- run: pip install nox 'virtualenv<20'
- run: pip install nox
env:
TEMP: "R:\\Temp"

Expand Down Expand Up @@ -221,8 +229,8 @@ jobs:
github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"

Expand All @@ -240,41 +248,6 @@ jobs:
--durations=5
--use-zipapp
# TODO: Remove this when we add Python 3.11 to CI.
tests-importlib-metadata:
name: tests for importlib.metadata backend
runs-on: ubuntu-latest
env:
_PIP_USE_IMPORTLIB_METADATA: 'true'

needs: [packaging, determine-changes]
if: >-
needs.determine-changes.outputs.tests == 'true' ||
github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.10'

- name: Install Ubuntu dependencies
run: sudo apt-get install bzr

- run: pip install nox 'virtualenv<20'

- name: Run unit tests
run: >-
nox -s test-3.10 --
-m unit
--verbose --numprocesses auto --showlocals
- name: Run integration tests
run: >-
nox -s test-3.10 --
-m integration
--verbose --numprocesses auto --showlocals
--durations=5
check: # This job does nothing and is only used for the branch protection
if: always()

Expand All @@ -285,7 +258,6 @@ jobs:
- tests-unix
- tests-windows
- tests-zipapp
- tests-importlib-metadata
- vendoring

runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/news-file.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
# `towncrier check` runs `git diff --name-only origin/main...`, which
# needs a non-shallow clone.
Expand Down
11 changes: 11 additions & 0 deletions NEWS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@
.. towncrier release notes start
22.3.1 (2022-11-05)
===================

Bug Fixes
---------

- Fix entry point generation of ``pip.X``, ``pipX.Y``, and ``easy_install-X.Y``
to correctly account for multi-digit Python version segments (e.g. the "11"
part of 3.11). (`#11547 <https://github.com/pypa/pip/issues/11547>`_)


22.3 (2022-10-15)
=================

Expand Down
7 changes: 7 additions & 0 deletions docs/html/development/release-process.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ their merits.
``pip._internal.utils.deprecation.deprecated``. The function is not a part of
pip's public API.

Supported Versions
==================

The latest version of the pip is the only supported version, previous
versions should be considered unsupported. Users are encouraged to make
regular updates to their version of pip in order to remain supported.

.. _`Python 2 Support`:

Python 2 Support
Expand Down
3 changes: 3 additions & 0 deletions news/11547.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fix entry point generation of ``pip.X``, ``pipX.Y``, and ``easy_install-X.Y``
to correctly account for multi-digit Python version segments (e.g. the "11"
part of 3.11).
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def should_update_common_wheels() -> bool:
# -----------------------------------------------------------------------------
# Development Commands
# -----------------------------------------------------------------------------
@nox.session(python=["3.7", "3.8", "3.9", "3.10", "pypy3"])
@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11", "pypy3"])
def test(session: nox.Session) -> None:
# Get the common wheels.
if should_update_common_wheels():
Expand Down
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ xfail_strict = True
markers =
network: tests that need network
incompatible_with_sysconfig
incompatible_with_test_venv
incompatible_with_venv
no_auto_tempdir_manager
unit: unit tests
Expand Down
4 changes: 2 additions & 2 deletions src/pip/_internal/operations/install/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def get_console_script_specs(console: Dict[str, str]) -> List[str]:

scripts_to_generate.append(f"pip{get_major_minor_version()} = {pip_script}")
# Delete any other versioned pip entry points
pip_ep = [k for k in console if re.match(r"pip(\d(\.\d)?)?$", k)]
pip_ep = [k for k in console if re.match(r"pip(\d+(\.\d+)?)?$", k)]
for k in pip_ep:
del console[k]
easy_install_script = console.pop("easy_install", None)
Expand All @@ -340,7 +340,7 @@ def get_console_script_specs(console: Dict[str, str]) -> List[str]:
)
# Delete any other versioned easy_install entry points
easy_install_ep = [
k for k in console if re.match(r"easy_install(-\d\.\d)?$", k)
k for k in console if re.match(r"easy_install(-\d+\.\d+)?$", k)
]
for k in easy_install_ep:
del console[k]
Expand Down
12 changes: 6 additions & 6 deletions src/pip/_internal/utils/virtualenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def _running_under_venv() -> bool:
return sys.prefix != getattr(sys, "base_prefix", sys.prefix)


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


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


def _get_pyvenv_cfg_lines() -> Optional[List[str]]:
Expand Down Expand Up @@ -77,7 +77,7 @@ def _no_global_under_venv() -> bool:
return False


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

if _running_under_regular_virtualenv():
return _no_global_under_regular_virtualenv()
if _running_under_legacy_virtualenv():
return _no_global_under_legacy_virtualenv()

return False
12 changes: 5 additions & 7 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,6 @@ def pytest_collection_modifyitems(config: Config, items: List[pytest.Function])
if item.get_closest_marker("network") is not None:
item.add_marker(pytest.mark.flaky(reruns=3, reruns_delay=2))

if item.get_closest_marker("incompatible_with_test_venv") and config.getoption(
"--use-venv"
):
item.add_marker(pytest.mark.skip("Incompatible with test venv"))
if (
item.get_closest_marker("incompatible_with_venv")
and sys.prefix != sys.base_prefix
Expand Down Expand Up @@ -474,9 +470,6 @@ def virtualenv_template(
):
(venv.bin / exe).unlink()

# Enable user site packages.
venv.user_site_packages = True

# Rename original virtualenv directory to make sure
# it's not reused by mistake from one of the copies.
venv_template = tmpdir / "venv_template"
Expand Down Expand Up @@ -742,3 +735,8 @@ def mock_server() -> Iterator[MockServer]:
@pytest.fixture
def proxy(request: pytest.FixtureRequest) -> str:
return request.config.getoption("proxy")


@pytest.fixture
def enable_user_site(virtualenv: VirtualEnvironment) -> None:
virtualenv.user_site_packages = True
2 changes: 1 addition & 1 deletion tests/functional/test_build_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def test_build_env_overlay_prefix_has_priority(script: PipTestEnvironment) -> No
assert result.stdout.strip() == "2.0", str(result)


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

# Create dummy `pkg` wheel.
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/test_freeze.py
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ def test_freeze_with_requirement_option_package_repeated_multi_file(


@pytest.mark.network
@pytest.mark.incompatible_with_test_venv
@pytest.mark.usefixtures("enable_user_site")
def test_freeze_user(
script: PipTestEnvironment, virtualenv: VirtualEnvironment, data: TestData
) -> None:
Expand Down Expand Up @@ -900,7 +900,7 @@ def test_freeze_path(tmpdir: Path, script: PipTestEnvironment, data: TestData) -


@pytest.mark.network
@pytest.mark.incompatible_with_test_venv
@pytest.mark.usefixtures("enable_user_site")
def test_freeze_path_exclude_user(
tmpdir: Path, script: PipTestEnvironment, data: TestData
) -> None:
Expand Down
Loading

0 comments on commit 3a1b9da

Please sign in to comment.