Commit aaf0661e authored by Jason R. Coombs's avatar Jason R. Coombs Committed by GitHub

Merge pull request #2537 from pypa/feature/drop-fetch-build-eggs-easy-install-fallback

Remove support for easy_install-based downloads for fetch_build_eggs
parents 8222d6f7 0afc4ef0
Remove fallback support for fetch_build_eggs using easy_install. Now pip is required for setup_requires to succeed.
......@@ -7,7 +7,6 @@ from distutils import log
from distutils.errors import DistutilsError
import pkg_resources
from setuptools.command.easy_install import easy_install
from setuptools.wheel import Wheel
......@@ -19,54 +18,11 @@ def _fixup_find_links(find_links):
return find_links
def _legacy_fetch_build_egg(dist, req):
"""Fetch an egg needed for building.
Legacy path using EasyInstall.
"""
tmp_dist = dist.__class__({'script_args': ['easy_install']})
opts = tmp_dist.get_option_dict('easy_install')
opts.clear()
opts.update(
(k, v)
for k, v in dist.get_option_dict('easy_install').items()
if k in (
# don't use any other settings
'find_links', 'site_dirs', 'index_url',
'optimize', 'site_dirs', 'allow_hosts',
))
if dist.dependency_links:
links = dist.dependency_links[:]
if 'find_links' in opts:
links = _fixup_find_links(opts['find_links'][1]) + links
opts['find_links'] = ('setup', links)
install_dir = dist.get_egg_cache_dir()
cmd = easy_install(
tmp_dist, args=["x"], install_dir=install_dir,
exclude_scripts=True,
always_copy=False, build_directory=None, editable=False,
upgrade=False, multi_version=True, no_report=True, user=False
)
cmd.ensure_finalized()
return cmd.easy_install(req)
def fetch_build_egg(dist, req): # noqa: C901 # is too complex (16) # FIXME
"""Fetch an egg needed for building.
Use pip/wheel to fetch/build a wheel."""
# Check pip is available.
try:
pkg_resources.get_distribution('pip')
except pkg_resources.DistributionNotFound:
dist.announce(
'WARNING: The pip package is not available, falling back '
'to EasyInstall for handling setup_requires/test_requires; '
'this is deprecated and will be removed in a future version.',
log.WARN
)
return _legacy_fetch_build_egg(dist, req)
# Warn if wheel is not.
# Warn if wheel is not available
try:
pkg_resources.get_distribution('wheel')
except pkg_resources.DistributionNotFound:
......
......@@ -742,10 +742,10 @@ class TestSetupRequires:
assert eggs == ['dep 1.0']
@pytest.mark.parametrize(
'use_legacy_installer,with_dependency_links_in_setup_py',
itertools.product((False, True), (False, True)))
'with_dependency_links_in_setup_py',
(False, True))
def test_setup_requires_with_find_links_in_setup_cfg(
self, monkeypatch, use_legacy_installer,
self, monkeypatch,
with_dependency_links_in_setup_py):
monkeypatch.setenv(str('PIP_RETRIES'), str('0'))
monkeypatch.setenv(str('PIP_TIMEOUT'), str('0'))
......@@ -767,11 +767,9 @@ class TestSetupRequires:
fp.write(DALS(
'''
from setuptools import installer, setup
if {use_legacy_installer}:
installer.fetch_build_egg = installer._legacy_fetch_build_egg
setup(setup_requires='python-xlib==42',
dependency_links={dependency_links!r})
''').format(use_legacy_installer=use_legacy_installer, # noqa
''').format(
dependency_links=dependency_links))
with open(test_setup_cfg, 'w') as fp:
fp.write(DALS(
......
......@@ -183,12 +183,6 @@ def test_test_command_install_requirements(virtualenv, tmpdir, request):
_check_test_command_install_requirements(virtualenv, tmpdir, request.config.rootdir)
def test_test_command_install_requirements_when_using_easy_install(
bare_virtualenv, tmpdir, request):
_check_test_command_install_requirements(
bare_virtualenv, tmpdir, request.config.rootdir)
def test_no_missing_dependencies(bare_virtualenv, request):
"""
Quick and dirty test to ensure all external dependencies are vendored.
......
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