Skip to content
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
1 change: 1 addition & 0 deletions newsfragments/2908.removal.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Removed support for the easy_install command including the sandbox module.
50 changes: 4 additions & 46 deletions setuptools/command/easy_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@
)
from setuptools import Command
from setuptools.archive_util import unpack_archive
from setuptools.command import bdist_egg, egg_info, setopt
from setuptools.command import bdist_egg, setopt
from setuptools.package_index import URL_SCHEME, PackageIndex, parse_requirement_arg
from setuptools.sandbox import run_setup
from setuptools.warnings import SetuptoolsDeprecationWarning, SetuptoolsWarning
from setuptools.wheel import Wheel

Expand Down Expand Up @@ -424,33 +423,7 @@ def expand_dirs(self) -> None:
self._expand_attrs(dirs)

def run(self, show_deprecation: bool = True) -> None:
if show_deprecation:
self.announce(
"WARNING: The easy_install command is deprecated "
"and will be removed in a future version.",
log.WARN,
)
if self.verbose != self.distribution.verbose:
log.set_verbosity(self.verbose)
try:
for spec in self.args:
self.easy_install(spec, not self.no_deps)
if self.record:
outputs = self.outputs
if self.root: # strip any package prefix
root_len = len(self.root)
for counter in range(len(outputs)):
outputs[counter] = outputs[counter][root_len:]
from distutils import file_util

self.execute(
file_util.write_file,
(self.record, outputs),
f"writing list of installed files to '{self.record}'",
)
self.warn_deprecated_options()
finally:
log.set_verbosity(self.distribution.verbose)
raise RuntimeError("easy_install command is disabled")

def pseudo_tempname(self):
"""Return a pseudo-tempname base in the install directory.
Expand Down Expand Up @@ -1175,23 +1148,8 @@ def report_editable(self, spec, setup_script):
python = sys.executable
return '\n' + self.__editable_msg % locals()

def run_setup(self, setup_script, setup_base, args) -> None:
sys.modules.setdefault('distutils.command.bdist_egg', bdist_egg)
sys.modules.setdefault('distutils.command.egg_info', egg_info)

args = list(args)
if self.verbose > 2:
v = 'v' * (self.verbose - 1)
args.insert(0, '-' + v)
elif self.verbose < 2:
args.insert(0, '-q')
if self.dry_run:
args.insert(0, '-n')
log.info("Running %s %s", setup_script[len(setup_base) + 1 :], ' '.join(args))
try:
run_setup(setup_script, args)
except SystemExit as v:
raise DistutilsError(f"Setup script exited with {v.args[0]}") from v
def run_setup(self, setup_script, setup_base, args) -> NoReturn:
raise NotImplementedError("easy_install support has been removed")

def build_and_install(self, setup_script, setup_base):
args = ['bdist_egg', '--dist-dir']
Expand Down
38 changes: 2 additions & 36 deletions setuptools/command/install.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
from __future__ import annotations

import glob
import inspect
import platform
from collections.abc import Callable
from typing import TYPE_CHECKING, Any, ClassVar, cast

import setuptools
from typing import TYPE_CHECKING, Any, ClassVar

from ..dist import Distribution
from ..warnings import SetuptoolsDeprecationWarning, SetuptoolsWarning
from .bdist_egg import bdist_egg as bdist_egg_cls

import distutils.command.install as orig
from distutils.errors import DistutilsArgError
Expand Down Expand Up @@ -144,37 +140,7 @@ def _called_from_setup(run_frame):
return False

def do_egg_install(self) -> None:
easy_install = self.distribution.get_command_class('easy_install')

cmd = cast(
# We'd want to cast easy_install as type[easy_install_cls] but a bug in
# mypy makes it think easy_install() returns a Command on Python 3.12+
# https://github.com/python/mypy/issues/18088
easy_install_cls,
easy_install( # type: ignore[call-arg]
self.distribution,
args="x",
root=self.root,
record=self.record,
),
)
cmd.ensure_finalized() # finalize before bdist_egg munges install cmd
cmd.always_copy_from = '.' # make sure local-dir eggs get installed

# pick up setup-dir .egg files only: no .egg-info
cmd.package_index.scan(glob.glob('*.egg'))

self.run_command('bdist_egg')
bdist_egg = cast(bdist_egg_cls, self.distribution.get_command_obj('bdist_egg'))
args = [bdist_egg.egg_output]

if setuptools.bootstrap_install_from:
# Bootstrap self-installation of setuptools
args.insert(0, setuptools.bootstrap_install_from)

cmd.args = args
cmd.run(show_deprecation=False)
setuptools.bootstrap_install_from = None
raise NotImplementedError("Support for egg-based install has been removed.")


# XXX Python 3.1 doesn't see _nc if this is inside the class
Expand Down
Loading
Loading