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

Deprecate setup.py install fallback when wheel package is absent #8560

Closed
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
2 changes: 2 additions & 0 deletions news/8559.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Deprecate call to 'setup.py install' when 'wheel' is absent for source
distributions without pyproject.toml
16 changes: 13 additions & 3 deletions src/pip/_internal/wheel_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from pip._internal.models.link import Link
from pip._internal.operations.build.wheel import build_wheel_pep517
from pip._internal.operations.build.wheel_legacy import build_wheel_legacy
from pip._internal.utils.deprecation import deprecated
from pip._internal.utils.logging import indent_log
from pip._internal.utils.misc import ensure_dir, hash_file, is_wheel_installed
from pip._internal.utils.setuptools_build import make_setuptools_clean_args
Expand Down Expand Up @@ -79,9 +80,18 @@ def _should_build(

if not req.use_pep517 and not is_wheel_installed():
# we don't build legacy requirements if wheel is not installed
logger.info(
"Using legacy 'setup.py install' for %s, "
"since package 'wheel' is not installed.", req.name,
deprecated(
reason=(
"Cannot build a wheel for {} which do not use PEP 517 "
"since package 'wheel' is not installed. "
"pip will fall back to legacy 'setup.py install' for this "
"package.".format(req.name)
),
replacement=(
"to install the 'wheel' package or enable --use-pep517"
),
gone_in="21.0",
issue=8559,
)
return False

Expand Down
2 changes: 1 addition & 1 deletion src/pip/_vendor/distlib/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ def __eq__(self, other):
__hash__ = object.__hash__


ENTRY_RE = re.compile(r'''(?P<name>(\w|[-.+])+)
ENTRY_RE = re.compile(r'''(?P<name>(\w|[-.+:])+)
\s*=\s*(?P<callable>(\w+)([:\.]\w+)*)
\s*(\[\s*(?P<flags>[\w-]+(=\w+)?(,\s*\w+(=\w+)?)*)\s*\])?
''', re.VERBOSE)
Expand Down
8 changes: 4 additions & 4 deletions tests/functional/test_install_reqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ def test_constraints_constrain_to_local(script, data, use_new_resolver):
if use_new_resolver:
assert 'Links are not allowed as constraints' in result.stderr
else:
assert 'Running setup.py install for singlemodule' in result.stdout
assert 'Successfully installed singlemodule' in result.stdout


def test_constrained_to_url_install_same_url(script, data, use_new_resolver):
Expand All @@ -423,7 +423,7 @@ def test_constrained_to_url_install_same_url(script, data, use_new_resolver):
if use_new_resolver:
assert 'Links are not allowed as constraints' in result.stderr
else:
assert ('Running setup.py install for singlemodule'
assert ('Successfully installed singlemodule'
in result.stdout), str(result)


Expand Down Expand Up @@ -531,7 +531,7 @@ def test_install_distribution_full_union(script, data):
to_install = data.packages.joinpath("LocalExtras")
result = script.pip_install_local(
to_install, to_install + "[bar]", to_install + "[baz]")
assert 'Running setup.py install for LocalExtras' in result.stdout
assert 'Successfully installed LocalExtras' in result.stdout
result.did_create(script.site_packages / 'simple')
result.did_create(script.site_packages / 'singlemodule.py')

Expand Down Expand Up @@ -563,7 +563,7 @@ def test_install_distribution_union_with_constraints(
msg = 'Unnamed requirements are not allowed as constraints'
assert msg in result.stderr
else:
assert 'Running setup.py install for LocalExtras' in result.stdout
assert 'Successfully installed LocalExtras' in result.stdout
result.did_create(script.site_packages / 'singlemodule.py')


Expand Down
2 changes: 1 addition & 1 deletion tests/functional/test_install_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def test_uninstall_rollback(script, data):
)
result.did_create(script.site_packages / 'broken.py')
result2 = script.pip(
'install', '-f', data.find_links, '--no-index', 'broken===0.2broken',
'install', '-f', data.find_links, '--no-index', 'brokenwheel==0.1',
expect_error=True,
)
assert result2.returncode == 1, str(result2)
Expand Down
15 changes: 9 additions & 6 deletions tests/functional/test_uninstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ def test_uninstall_overlapping_package(script, data):


@pytest.mark.parametrize("console_scripts",
["test_ = distutils_install",
"test_:test_ = distutils_install"])
["test_ = thescript:main",
"test_:test_ = thescript:main"])
def test_uninstall_entry_point_colon_in_name(script, console_scripts):
"""
Test uninstall package with two or more entry points in the same section,
Expand All @@ -205,10 +205,11 @@ def test_uninstall_entry_point_colon_in_name(script, console_scripts):
version='0.1',
entry_points={"console_scripts": [console_scripts, ],
"pip_test.ep":
["ep:name1 = distutils_install",
"ep:name2 = distutils_install"]
["ep:name1 = thescript:main",
"ep:name2 = thescript:main"]
}
)
(pkg_path / "thescript.py").write_text("def main(): pass")
script_name = script.bin_path.joinpath(
console_scripts.split('=')[0].strip()
)
Expand All @@ -235,8 +236,9 @@ def test_uninstall_gui_scripts(script):
script,
name=pkg_name,
version='0.1',
entry_points={"gui_scripts": ["test_ = distutils_install", ], }
entry_points={"gui_scripts": ["test_ = thescript:main", ], }
)
(pkg_path / "thescript.py").write_text("def main(): pass")
script_name = script.bin_path.joinpath('test_')
if sys.platform == 'win32':
script_name += '.exe'
Expand Down Expand Up @@ -273,10 +275,11 @@ def test_uninstall_console_scripts_uppercase_name(script):
version='0.1',
entry_points={
"console_scripts": [
"Test = distutils_install",
"Test = thescript:main",
],
},
)
(pkg_path / "thescript.py").write_text("def main(): pass")
script_name = script.bin_path.joinpath('Test' + script.exe)

script.pip('install', pkg_path)
Expand Down