diff options
| author | Benoit Pierre <benoit.pierre@gmail.com> | 2019-11-14 21:51:33 +0100 |
|---|---|---|
| committer | Benoit Pierre <benoit.pierre@gmail.com> | 2019-11-15 20:06:07 +0100 |
| commit | 6e1838a9fb5feb000ba9b6a3c37c8b39d7e872b3 (patch) | |
| tree | fc05e138e5ff28ca7855e80af6cc89cb76eb81d2 /setuptools | |
| parent | d6948c636f5e657ac56911b71b7a459d326d8389 (diff) | |
| download | python-setuptools-git-6e1838a9fb5feb000ba9b6a3c37c8b39d7e872b3.tar.gz | |
drop easy_install script and associated documentation
Diffstat (limited to 'setuptools')
| -rw-r--r-- | setuptools/command/easy_install.py | 55 | ||||
| -rw-r--r-- | setuptools/tests/test_easy_install.py | 34 | ||||
| -rw-r--r-- | setuptools/tests/test_namespaces.py | 5 |
3 files changed, 21 insertions, 73 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index 545c3c44..9d350ac0 100644 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -73,7 +73,7 @@ warnings.filterwarnings("default", category=pkg_resources.PEP440Warning) __all__ = [ 'samefile', 'easy_install', 'PthDistributions', 'extract_wininst_cfg', - 'main', 'get_exe_prefixes', + 'get_exe_prefixes', ] @@ -2283,59 +2283,6 @@ def current_umask(): return tmp -def bootstrap(): - # This function is called when setuptools*.egg is run using /bin/sh - import setuptools - - argv0 = os.path.dirname(setuptools.__path__[0]) - sys.argv[0] = argv0 - sys.argv.append(argv0) - main() - - -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): """Class for warning about deprecations in EasyInstall in SetupTools. Not ignored by default, unlike DeprecationWarning.""" diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py index aa75899a..68319c2f 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -467,22 +467,24 @@ class TestSetupRequires: """ monkeypatch.setenv(str('PIP_RETRIES'), str('0')) monkeypatch.setenv(str('PIP_TIMEOUT'), str('0')) - with contexts.quiet(): - # create an sdist that has a build-time dependency. - with TestSetupRequires.create_sdist() as dist_file: - with contexts.tempdir() as temp_install_dir: - with contexts.environment(PYTHONPATH=temp_install_dir): - ei_params = [ - '--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) + monkeypatch.setenv(str('PIP_VERBOSE'), str('1')) + # create an sdist that has a build-time dependency. + with TestSetupRequires.create_sdist() as dist_file: + with contexts.tempdir() as temp_dir: + setup_py = os.path.join(temp_dir, 'setup.py') + with open(setup_py, 'w') as fp: + fp.write('__import__("setuptools").setup()') + temp_install_dir = os.path.join(temp_dir, 'target') + os.mkdir(temp_install_dir) + with contexts.environment(PYTHONPATH=temp_install_dir): + # attempt to install the dist. It should + # fail because it doesn't exist. + with pytest.raises(SystemExit): + run_setup(setup_py, ['easy_install', + '--exclude-scripts', + '--index-url', mock_index.url, + '--install-dir', temp_install_dir, + dist_file]) # there should have been one requests to the server assert [r.path for r in mock_index.requests] == ['/does-not-exist/'] diff --git a/setuptools/tests/test_namespaces.py b/setuptools/tests/test_namespaces.py index f937d981..3c5df68a 100644 --- a/setuptools/tests/test_namespaces.py +++ b/setuptools/tests/test_namespaces.py @@ -64,9 +64,8 @@ class TestNamespaces: target.mkdir() install_cmd = [ sys.executable, - '-m', 'easy_install', - '-d', str(target), - str(pkg), + '-m', 'pip.__main__', 'install', + '-t', str(target), str(pkg), ] with test.test.paths_on_pythonpath([str(target)]): subprocess.check_call(install_cmd) |
