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

Remove easy_install script and module. #2544

Merged
merged 3 commits into from
Jan 24, 2021
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 changelog.d/2544.breaking.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Removed 'easy_install' top-level model (runpy entry point) and 'easy_install' console script.
5 changes: 0 additions & 5 deletions easy_install.py

This file was deleted.

1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ project_urls =

[options]
packages = find_namespace:
py_modules = easy_install
# disabled as it causes tests to be included #2505
# include_package_data = true
python_requires = >=3.6
Expand Down
17 changes: 0 additions & 17 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,6 @@ def read_commands():
return command_ns['__all__']


def _gen_console_scripts():
yield "easy_install = setuptools.command.easy_install:main"

# Gentoo distributions manage the python-version-specific scripts
# themselves, so those platforms define an environment variable to
# suppress the creation of the version-specific scripts.
var_names = (
'SETUPTOOLS_DISABLE_VERSIONED_EASY_INSTALL_SCRIPT',
'DISTRIBUTE_DISABLE_VERSIONED_EASY_INSTALL_SCRIPT',
)
if any(os.environ.get(var) not in (None, "", "0") for var in var_names):
return
tmpl = "easy_install-{shortver} = setuptools.command.easy_install:main"
yield tmpl.format(shortver='{}.{}'.format(*sys.version_info))


package_data = dict(
setuptools=['script (dev).tmpl', 'script.tmpl', 'site-patch.py'],
)
Expand Down Expand Up @@ -170,7 +154,6 @@ def _restore_install_lib(self):
"depends.txt = setuptools.command.egg_info:warn_depends_obsolete",
"dependency_links.txt = setuptools.command.egg_info:overwrite_arg",
],
"console_scripts": list(_gen_console_scripts()),
},
dependency_links=[
pypi_link(
Expand Down
46 changes: 1 addition & 45 deletions setuptools/command/easy_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@

__all__ = [
'samefile', 'easy_install', 'PthDistributions', 'extract_wininst_cfg',
'main', 'get_exe_prefixes',
'get_exe_prefixes',
]


Expand Down Expand Up @@ -2284,50 +2284,6 @@ def current_umask():
return tmp


def main(argv=None, **kw):
from setuptools import setup
from setuptools.dist import Distribution

class DistributionWithoutHelpCommands(Distribution):
common_usage = ""

def _show_help(self, *args, **kw):
with _patch_usage():
Distribution._show_help(self, *args, **kw)

if argv is None:
argv = sys.argv[1:]

with _patch_usage():
setup(
script_args=['-q', 'easy_install', '-v'] + argv,
script_name=sys.argv[0] or 'easy_install',
distclass=DistributionWithoutHelpCommands,
**kw
)


@contextlib.contextmanager
def _patch_usage():
import distutils.core
USAGE = textwrap.dedent("""
usage: %(script)s [options] requirement_or_url ...
or: %(script)s --help
""").lstrip()

def gen_usage(script_name):
return USAGE % dict(
script=os.path.basename(script_name),
)

saved = distutils.core.gen_usage
distutils.core.gen_usage = gen_usage
try:
yield
finally:
distutils.core.gen_usage = saved


class EasyInstallDeprecationWarning(SetuptoolsDeprecationWarning):
"""
Warning for EasyInstall deprecations, bypassing suppression.
Expand Down
13 changes: 6 additions & 7 deletions setuptools/tests/test_easy_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import mock
import time
import re
import subprocess

import pytest

Expand All @@ -25,7 +26,6 @@
EasyInstallDeprecationWarning, ScriptWriter, PthDistributions,
WindowsScriptWriter,
)
from setuptools.command import easy_install as easy_install_pkg
from setuptools.dist import Distribution
from pkg_resources import normalize_path, working_set
from pkg_resources import Distribution as PRDistribution
Expand Down Expand Up @@ -461,17 +461,16 @@ def test_setup_requires_honors_fetch_params(self, mock_index, monkeypatch):
with TestSetupRequires.create_sdist() as dist_file:
with contexts.tempdir() as temp_install_dir:
with contexts.environment(PYTHONPATH=temp_install_dir):
ei_params = [
cmd = [
sys.executable,
'-m', 'setup',
'easy_install',
'--index-url', mock_index.url,
'--exclude-scripts',
'--install-dir', temp_install_dir,
dist_file,
]
with sandbox.save_argv(['easy_install']):
# attempt to install the dist. It should
# fail because it doesn't exist.
with pytest.raises(SystemExit):
easy_install_pkg.main(ei_params)
subprocess.Popen(cmd).wait()
# there should have been one requests to the server
assert [r.path for r in mock_index.requests] == ['/does-not-exist/']

Expand Down
5 changes: 3 additions & 2 deletions setuptools/tests/test_namespaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ def test_pkg_resources_import(self, tmpdir):
target.mkdir()
install_cmd = [
sys.executable,
'-m', 'easy_install',
'-d', str(target),
'-m', 'pip',
'install',
'-t', str(target),
str(pkg),
]
with test.test.paths_on_pythonpath([str(target)]):
Expand Down