Commit a1e956b2 authored by Benoit Pierre's avatar Benoit Pierre

Revert "drop easy_install script and associated documentation"

This reverts commit 6e1838a9.
parent 68dbb703
This diff is collapsed.
...@@ -21,4 +21,5 @@ Documentation content: ...@@ -21,4 +21,5 @@ Documentation content:
python3 python3
development development
roadmap roadmap
Deprecated: Easy Install <easy_install>
history history
"""Run the EasyInstall command"""
if __name__ == '__main__':
from setuptools.command.easy_install import main
main()
...@@ -51,6 +51,7 @@ classifiers = ...@@ -51,6 +51,7 @@ classifiers =
[options] [options]
zip_safe = True zip_safe = True
python_requires = >=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.* python_requires = >=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*
py_modules = easy_install
packages = find: packages = find:
[options.packages.find] [options.packages.find]
......
...@@ -31,6 +31,22 @@ def read_commands(): ...@@ -31,6 +31,22 @@ def read_commands():
return command_ns['__all__'] 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( package_data = dict(
setuptools=['script (dev).tmpl', 'script.tmpl', 'site-patch.py'], setuptools=['script (dev).tmpl', 'script.tmpl', 'site-patch.py'],
) )
...@@ -109,6 +125,9 @@ setup_params = dict( ...@@ -109,6 +125,9 @@ setup_params = dict(
"depends.txt = setuptools.command.egg_info:warn_depends_obsolete", "depends.txt = setuptools.command.egg_info:warn_depends_obsolete",
"dependency_links.txt = setuptools.command.egg_info:overwrite_arg", "dependency_links.txt = setuptools.command.egg_info:overwrite_arg",
], ],
"console_scripts": list(_gen_console_scripts()),
"setuptools.installation":
['eggsecutable = setuptools.command.easy_install:bootstrap'],
}, },
dependency_links=[ dependency_links=[
pypi_link( pypi_link(
......
...@@ -73,7 +73,7 @@ warnings.filterwarnings("default", category=pkg_resources.PEP440Warning) ...@@ -73,7 +73,7 @@ warnings.filterwarnings("default", category=pkg_resources.PEP440Warning)
__all__ = [ __all__ = [
'samefile', 'easy_install', 'PthDistributions', 'extract_wininst_cfg', 'samefile', 'easy_install', 'PthDistributions', 'extract_wininst_cfg',
'get_exe_prefixes', 'main', 'get_exe_prefixes',
] ]
...@@ -2289,6 +2289,59 @@ def current_umask(): ...@@ -2289,6 +2289,59 @@ def current_umask():
return tmp 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 EasyInstallDeprecationWarning(SetuptoolsDeprecationWarning):
"""Class for warning about deprecations in EasyInstall in SetupTools. Not ignored by default, unlike DeprecationWarning.""" """Class for warning about deprecations in EasyInstall in SetupTools. Not ignored by default, unlike DeprecationWarning."""
...@@ -467,24 +467,22 @@ class TestSetupRequires: ...@@ -467,24 +467,22 @@ class TestSetupRequires:
""" """
monkeypatch.setenv(str('PIP_RETRIES'), str('0')) monkeypatch.setenv(str('PIP_RETRIES'), str('0'))
monkeypatch.setenv(str('PIP_TIMEOUT'), str('0')) monkeypatch.setenv(str('PIP_TIMEOUT'), str('0'))
monkeypatch.setenv(str('PIP_VERBOSE'), str('1')) with contexts.quiet():
# create an sdist that has a build-time dependency. # create an sdist that has a build-time dependency.
with TestSetupRequires.create_sdist() as dist_file: with TestSetupRequires.create_sdist() as dist_file:
with contexts.tempdir() as temp_dir: with contexts.tempdir() as temp_install_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): 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 # attempt to install the dist. It should
# fail because it doesn't exist. # fail because it doesn't exist.
with pytest.raises(SystemExit): with pytest.raises(SystemExit):
run_setup(setup_py, ['easy_install', easy_install_pkg.main(ei_params)
'--exclude-scripts',
'--index-url', mock_index.url,
'--install-dir', temp_install_dir,
dist_file])
# there should have been one requests to the server # there should have been one requests to the server
assert [r.path for r in mock_index.requests] == ['/does-not-exist/'] assert [r.path for r in mock_index.requests] == ['/does-not-exist/']
......
...@@ -64,8 +64,9 @@ class TestNamespaces: ...@@ -64,8 +64,9 @@ class TestNamespaces:
target.mkdir() target.mkdir()
install_cmd = [ install_cmd = [
sys.executable, sys.executable,
'-m', 'pip.__main__', 'install', '-m', 'easy_install',
'-t', str(target), str(pkg), '-d', str(target),
str(pkg),
] ]
with test.test.paths_on_pythonpath([str(target)]): with test.test.paths_on_pythonpath([str(target)]):
subprocess.check_call(install_cmd) subprocess.check_call(install_cmd)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment