Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drop support for pip <19.0.0 #8894

Merged
merged 3 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions src/poetry/installation/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,15 +696,6 @@ def _install_directory_without_wheel_installer(
package_poetry = Factory().create_poetry(pyproject.file.path.parent)

if package_poetry is not None:
# Even if there is a build system specified
# some versions of pip (< 19.0.0) don't understand it
# so we need to check the version of pip to know
# if we can rely on the build system
legacy_pip = (
self._env.pip_version
< self._env.pip_version.__class__.from_parts(19, 0, 0)
)

builder: Builder
if package.develop and not package_poetry.package.build_script:
from poetry.masonry.builders.editable import EditableBuilder
Expand All @@ -716,13 +707,10 @@ def _install_directory_without_wheel_installer(
builder.build()

return 0
elif legacy_pip or package_poetry.package.build_script:

if package_poetry.package.build_script:
from poetry.core.masonry.builders.sdist import SdistBuilder

# We need to rely on creating a temporary setup.py
# file since the version of pip does not support
# build-systems
# We also need it for non-PEP-517 packages
builder = SdistBuilder(package_poetry)
with builder.setup_py():
return self.pip_install(req, upgrade=True, editable=package.develop)
Expand Down
12 changes: 0 additions & 12 deletions src/poetry/utils/env/base_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

if TYPE_CHECKING:
from packaging.tags import Tag
from poetry.core.constraints.version import Version
from poetry.core.version.markers import BaseMarker
from virtualenv.seed.wheels.util import Wheel

Expand Down Expand Up @@ -54,7 +53,6 @@ def __init__(self, path: Path, base: Path | None = None) -> None:
self._base = base or path

self._marker_env: dict[str, Any] | None = None
self._pip_version: Version | None = None
self._site_packages: SitePackages | None = None
self._paths: dict[str, str] | None = None
self._supported_tags: list[Tag] | None = None
Expand Down Expand Up @@ -170,13 +168,6 @@ def platform(self) -> str:
def os(self) -> str:
return os.name

@property
def pip_version(self) -> Version:
if self._pip_version is None:
self._pip_version = self.get_pip_version()

return self._pip_version

@property
def site_packages(self) -> SitePackages:
if self._site_packages is None:
Expand Down Expand Up @@ -288,9 +279,6 @@ def get_pip_command(self, embedded: bool = False) -> list[str]:
def get_supported_tags(self) -> list[Tag]:
raise NotImplementedError()

def get_pip_version(self) -> Version:
raise NotImplementedError()

def get_paths(self) -> dict[str, str]:
raise NotImplementedError()

Expand Down
8 changes: 0 additions & 8 deletions src/poetry/utils/env/mock_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
from typing import TYPE_CHECKING
from typing import Any

from poetry.core.constraints.version import Version

from poetry.utils.env.null_env import NullEnv


Expand All @@ -22,7 +20,6 @@ def __init__(
platform_machine: str = "amd64",
os_name: str = "posix",
is_venv: bool = False,
pip_version: str = "19.1",
sys_path: list[str] | None = None,
marker_env: dict[str, Any] | None = None,
supported_tags: list[Tag] | None = None,
Expand All @@ -36,7 +33,6 @@ def __init__(
self._platform_machine = platform_machine
self._os_name = os_name
self._is_venv = is_venv
self._pip_version: Version = Version.parse(pip_version)
self._sys_path = sys_path
self._mock_marker_env = marker_env
self._supported_tags = supported_tags
Expand All @@ -53,10 +49,6 @@ def platform_machine(self) -> str:
def os(self) -> str:
return self._os_name

@property
def pip_version(self) -> Version:
return self._pip_version

@property
def sys_path(self) -> list[str]:
if self._sys_path is None:
Expand Down
6 changes: 0 additions & 6 deletions src/poetry/utils/env/system_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from packaging.tags import interpreter_name
from packaging.tags import interpreter_version
from packaging.tags import sys_tags
from poetry.core.constraints.version import Version

from poetry.utils.env.base_env import Env

Expand Down Expand Up @@ -81,11 +80,6 @@ def get_marker_env(self) -> dict[str, Any]:
"interpreter_version": interpreter_version(),
}

def get_pip_version(self) -> Version:
from pip import __version__

return Version.parse(__version__)

def is_venv(self) -> bool:
return self._path != self._base

Expand Down
11 changes: 0 additions & 11 deletions src/poetry/utils/env/virtual_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from typing import Any

from packaging.tags import Tag
from poetry.core.constraints.version import Version

from poetry.utils.env.base_env import Env
from poetry.utils.env.script_strings import GET_BASE_PREFIX
Expand Down Expand Up @@ -72,16 +71,6 @@ def get_marker_env(self) -> dict[str, Any]:
env: dict[str, Any] = json.loads(output)
return env

def get_pip_version(self) -> Version:
output = self.run_pip("--version")
output = output.strip()

m = re.match("pip (.+?)(?: from .+)?$", output)
if not m:
return Version.parse("0.0")

return Version.parse(m.group(1))

def get_paths(self) -> dict[str, str]:
output = self.run_python_script(GET_PATHS)
paths: dict[str, str] = json.loads(output)
Expand Down
6 changes: 3 additions & 3 deletions tests/utils/env/test_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import contextlib
import os
import re
import site
import subprocess
import sys
Expand Down Expand Up @@ -82,9 +83,8 @@ def test_env_commands_with_spaces_in_their_arg_work_as_expected(
venv_path = tmp_path / "Virtual Env"
manager.build_venv(venv_path)
venv = VirtualEnv(venv_path)
assert venv.run("python", str(venv.pip), "--version").startswith(
f"pip {venv.pip_version} from "
)
output = venv.run("python", str(venv.pip), "--version")
assert re.match(r"pip \S+ from", output)


def test_env_get_supported_tags_matches_inside_virtualenv(
Expand Down
Loading