Skip to content

Commit

Permalink
Merge branch 'main' into issues/13086
Browse files Browse the repository at this point in the history
  • Loading branch information
jsirois authored Feb 4, 2025
2 parents a2207f2 + 7e9c87a commit eeb47c8
Show file tree
Hide file tree
Showing 49 changed files with 55 additions and 88 deletions.
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ c7ee560e00b85f7486b452c14ff49e4737996eda # Blacken tools/
94999255d5ede440c37137d210666fdf64302e75 # Reformat the codebase, with black
585037a80a1177f1fa92e159a7079855782e543e # Cleanup implicit string concatenation
8a6f6ac19b80a6dc35900a47016c851d9fcd2ee2 # Blacken src/pip/_internal/resolution directory
acfcae8941bb12ecfc372a05c875a7b414992604 # Reformat with Black's 2025 code style
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repos:
exclude: .patch

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.10.0
rev: 25.1.0
hooks:
- id: black

Expand Down
1 change: 1 addition & 0 deletions news/13156.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Show the correct path to the interpreter also when it's a symlink in a venv in the pip upgrade prompt.
1 change: 1 addition & 0 deletions news/13186.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix regression where truststore would never be used while installing build dependencies.
3 changes: 1 addition & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Automation using nox.
"""
"""Automation using nox."""

import argparse
import glob
Expand Down
8 changes: 3 additions & 5 deletions src/pip/_internal/build_env.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Build Environment used for isolation during sdist building
"""
"""Build Environment used for isolation during sdist building"""

import logging
import os
Expand All @@ -11,7 +10,6 @@
from types import TracebackType
from typing import TYPE_CHECKING, Iterable, List, Optional, Set, Tuple, Type, Union

from pip._vendor.certifi import where
from pip._vendor.packaging.version import Version

from pip import __file__ as pip_location
Expand Down Expand Up @@ -246,8 +244,6 @@ def _install_requirements(
# target from config file or env var should be ignored
"--target",
"",
"--cert",
finder.custom_cert or where(),
]
if logger.getEffectiveLevel() <= logging.DEBUG:
args.append("-vv")
Expand Down Expand Up @@ -276,6 +272,8 @@ def _install_requirements(
args.extend(["--proxy", finder.proxy])
for host in finder.trusted_hosts:
args.extend(["--trusted-host", host])
if finder.custom_cert:
args.extend(["--cert", finder.custom_cert])
if finder.client_cert:
args.extend(["--client-cert", finder.client_cert])
if finder.allow_all_prereleases:
Expand Down
3 changes: 1 addition & 2 deletions src/pip/_internal/cache.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Cache Management
"""
"""Cache Management"""

import hashlib
import json
Expand Down
3 changes: 1 addition & 2 deletions src/pip/_internal/cli/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
"""Subpackage containing all of pip's command line interface related code
"""
"""Subpackage containing all of pip's command line interface related code"""

# This file intentionally does not import submodules
3 changes: 1 addition & 2 deletions src/pip/_internal/cli/autocompletion.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Logic that powers autocompletion installed by ``pip completion``.
"""
"""Logic that powers autocompletion installed by ``pip completion``."""

import optparse
import os
Expand Down
3 changes: 1 addition & 2 deletions src/pip/_internal/cli/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Primary application entrypoint.
"""
"""Primary application entrypoint."""

import locale
import logging
Expand Down
3 changes: 1 addition & 2 deletions src/pip/_internal/cli/main_parser.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""A single place for constructing and exposing the main parser
"""
"""A single place for constructing and exposing the main parser"""

import os
import subprocess
Expand Down
3 changes: 1 addition & 2 deletions src/pip/_internal/index/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
"""Index interaction code
"""
"""Index interaction code"""
3 changes: 1 addition & 2 deletions src/pip/_internal/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
"""A package that contains models that represent entities.
"""
"""A package that contains models that represent entities."""
2 changes: 1 addition & 1 deletion src/pip/_internal/models/direct_url.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" PEP 610 """
"""PEP 610"""

import json
import re
Expand Down
3 changes: 1 addition & 2 deletions src/pip/_internal/network/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
"""Contains purely network-related utilities.
"""
"""Contains purely network-related utilities."""
3 changes: 1 addition & 2 deletions src/pip/_internal/network/cache.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""HTTP cache implementation.
"""
"""HTTP cache implementation."""

import os
from contextlib import contextmanager
Expand Down
3 changes: 1 addition & 2 deletions src/pip/_internal/network/download.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Download files with progress indicators.
"""
"""Download files with progress indicators."""

import email.message
import logging
Expand Down
3 changes: 1 addition & 2 deletions src/pip/_internal/network/xmlrpc.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""xmlrpclib.Transport implementation
"""
"""xmlrpclib.Transport implementation"""

import logging
import urllib.parse
Expand Down
3 changes: 1 addition & 2 deletions src/pip/_internal/operations/build/metadata.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Metadata generation logic for source distributions.
"""
"""Metadata generation logic for source distributions."""

import os

Expand Down
3 changes: 1 addition & 2 deletions src/pip/_internal/operations/build/metadata_editable.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Metadata generation logic for source distributions.
"""
"""Metadata generation logic for source distributions."""

import os

Expand Down
3 changes: 1 addition & 2 deletions src/pip/_internal/operations/build/metadata_legacy.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Metadata generation logic for legacy source distributions.
"""
"""Metadata generation logic for legacy source distributions."""

import logging
import os
Expand Down
3 changes: 1 addition & 2 deletions src/pip/_internal/operations/check.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Validation of dependencies of packages
"""
"""Validation of dependencies of packages"""

import logging
from contextlib import suppress
Expand Down
3 changes: 1 addition & 2 deletions src/pip/_internal/operations/install/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
"""For modules related to installing packages.
"""
"""For modules related to installing packages."""
3 changes: 1 addition & 2 deletions src/pip/_internal/operations/install/editable_legacy.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Legacy editable installation process, i.e. `setup.py develop`.
"""
"""Legacy editable installation process, i.e. `setup.py develop`."""

import logging
from typing import Optional, Sequence
Expand Down
3 changes: 1 addition & 2 deletions src/pip/_internal/operations/install/wheel.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Support for installing and building the "wheel" binary package format.
"""
"""Support for installing and building the "wheel" binary package format."""

import collections
import compileall
Expand Down
3 changes: 1 addition & 2 deletions src/pip/_internal/operations/prepare.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Prepares a distribution for installation
"""
"""Prepares a distribution for installation"""

# The following comment should be removed at some point in the future.
# mypy: strict-optional=False
Expand Down
2 changes: 1 addition & 1 deletion src/pip/_internal/req/req_uninstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def _script_names(


def _unique(
fn: Callable[..., Generator[Any, None, None]]
fn: Callable[..., Generator[Any, None, None]],
) -> Callable[..., Generator[Any, None, None]]:
@functools.wraps(fn)
def unique(*args: Any, **kw: Any) -> Generator[Any, None, None]:
Expand Down
3 changes: 1 addition & 2 deletions src/pip/_internal/utils/compatibility_tags.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Generate and work with PEP 425 Compatibility Tags.
"""
"""Generate and work with PEP 425 Compatibility Tags."""

import re
from typing import List, Optional, Tuple
Expand Down
3 changes: 1 addition & 2 deletions src/pip/_internal/utils/datetime.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""For when pip wants to check the date or time.
"""
"""For when pip wants to check the date or time."""

import datetime

Expand Down
5 changes: 4 additions & 1 deletion src/pip/_internal/utils/entrypoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ def get_best_invocation_for_this_python() -> str:

# Try to use the basename, if it's the first executable.
found_executable = shutil.which(exe_name)
if found_executable and os.path.samefile(found_executable, exe):
# Virtual environments often symlink to their parent Python binaries, but we don't
# want to treat the Python binaries as equivalent when the environment's Python is
# not on PATH (not activated). Thus, we don't follow symlinks.
if found_executable and os.path.samestat(os.lstat(found_executable), os.lstat(exe)):
return exe_name

# Use the full executable name, because we couldn't find something simpler.
Expand Down
3 changes: 1 addition & 2 deletions src/pip/_internal/utils/filetypes.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Filetype information.
"""
"""Filetype information."""

from typing import Tuple

Expand Down
3 changes: 1 addition & 2 deletions src/pip/_internal/utils/unpacking.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Utilities related archives.
"""
"""Utilities related archives."""

import logging
import os
Expand Down
3 changes: 1 addition & 2 deletions src/pip/_internal/utils/wheel.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Support functions for working with wheel files.
"""
"""Support functions for working with wheel files."""

import logging
from email.message import Message
Expand Down
3 changes: 1 addition & 2 deletions src/pip/_internal/wheel_builder.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Orchestrator for building wheels from InstallRequirements.
"""
"""Orchestrator for building wheels from InstallRequirements."""

import logging
import os.path
Expand Down
3 changes: 1 addition & 2 deletions tests/functional/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Basic CLI functionality checks.
"""
"""Basic CLI functionality checks."""

import subprocess
import sys
Expand Down
3 changes: 1 addition & 2 deletions tests/functional/test_configuration.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Tests for the config command
"""
"""Tests for the config command"""

import re
import textwrap
Expand Down
3 changes: 1 addition & 2 deletions tests/lib/configuration_helpers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Helpers for tests that check configuration
"""
"""Helpers for tests that check configuration"""

import contextlib
import functools
Expand Down
3 changes: 1 addition & 2 deletions tests/lib/filesystem.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Helpers for filesystem-dependent tests.
"""
"""Helpers for filesystem-dependent tests."""

import os
from contextlib import contextmanager
Expand Down
3 changes: 1 addition & 2 deletions tests/lib/options_helpers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Provides helper classes for testing option handling in pip
"""
"""Provides helper classes for testing option handling in pip"""

from optparse import Values
from typing import List, Tuple
Expand Down
3 changes: 1 addition & 2 deletions tests/lib/requests_mocks.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Helper classes as mocks for requests objects.
"""
"""Helper classes as mocks for requests objects."""

from io import BytesIO
from typing import Any, Callable, Dict, Iterator, List, Optional
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def make_environ(self) -> Dict[str, Any]:


def _mock_wsgi_adapter(
mock: Callable[["WSGIEnvironment", "StartResponse"], "WSGIApplication"]
mock: Callable[["WSGIEnvironment", "StartResponse"], "WSGIApplication"],
) -> "WSGIApplication":
"""Uses a mock to record function arguments and provide
the actual function that should respond.
Expand Down
3 changes: 1 addition & 2 deletions tests/lib/test_wheel.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Tests for wheel helper.
"""
"""Tests for wheel helper."""

import csv
from email import message_from_string
Expand Down
3 changes: 1 addition & 2 deletions tests/lib/wheel.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Helper for building wheels as would be in test cases.
"""
"""Helper for building wheels as would be in test cases."""

import csv
import itertools
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/resolution_resolvelib/test_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def resolver(preparer: RequirementPreparer, finder: PackageFinder) -> Resolver:


def _make_graph(
edges: List[Tuple[Optional[str], Optional[str]]]
edges: List[Tuple[Optional[str], Optional[str]]],
) -> "DirectedGraph[Optional[str]]":
"""Build graph from edge declarations."""

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_appdirs.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def test_user_cache_dir_unicode(self, monkeypatch: pytest.MonkeyPatch) -> None:
return

def my_get_win_folder(csidl_name: str) -> str:
return "\u00DF\u00E4\u03B1\u20AC"
return "\u00df\u00e4\u03b1\u20ac"

monkeypatch.setattr(
platformdirs.windows, # type: ignore
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_base_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ class FakeCommandWithUnicode(FakeCommand):
_name = "fake_unicode"

def run(self, options: Values, args: List[str]) -> int:
logging.getLogger("pip.tests").info(b"bytes here \xE9")
logging.getLogger("pip.tests").info(b"unicode here \xC3\xA9".decode("utf-8"))
logging.getLogger("pip.tests").info(b"bytes here \xe9")
logging.getLogger("pip.tests").info(b"unicode here \xc3\xa9".decode("utf-8"))
return SUCCESS


Expand Down
3 changes: 1 addition & 2 deletions tests/unit/test_configuration.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Tests for all things related to the configuration
"""
"""Tests for all things related to the configuration"""

import re
from unittest.mock import MagicMock
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/test_models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Tests for various classes in pip._internal.models
"""
"""Tests for various classes in pip._internal.models"""

from pip._vendor.packaging.version import parse as parse_version

Expand Down
3 changes: 1 addition & 2 deletions tools/release/check_version.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Checks if the version is acceptable, as per this project's release process.
"""
"""Checks if the version is acceptable, as per this project's release process."""

import sys
from datetime import datetime
Expand Down

0 comments on commit eeb47c8

Please sign in to comment.