mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Have a nice error when setuptools is not available
This commit is contained in:
parent
cb7af82f20
commit
f934b77d61
2 changed files with 21 additions and 0 deletions
|
@ -261,6 +261,15 @@ class InstallRequirement(object):
|
|||
|
||||
@property
|
||||
def setup_py(self):
|
||||
try:
|
||||
import pkg_resources
|
||||
except ImportError:
|
||||
# Setuptools is not available
|
||||
raise InstallationError(
|
||||
"setuptools must be installed to install from a source "
|
||||
"distribution"
|
||||
)
|
||||
|
||||
setup_file = 'setup.py'
|
||||
|
||||
if self.editable_options and 'subdirectory' in self.editable_options:
|
||||
|
|
|
@ -13,6 +13,18 @@ from tests.lib.local_repos import local_checkout
|
|||
from tests.lib.path import Path
|
||||
|
||||
|
||||
def test_without_setuptools(script):
|
||||
script.run("pip", "uninstall", "setuptools", "-y")
|
||||
result = script.run(
|
||||
"python", "-m", "pip", "install", "INITools==0.2", "--no-use-wheel",
|
||||
expect_error=True,
|
||||
)
|
||||
assert (
|
||||
"setuptools must be installed to install from a source distribution"
|
||||
in result.stdout
|
||||
)
|
||||
|
||||
|
||||
def test_pip_second_command_line_interface_works(script):
|
||||
"""
|
||||
Check if ``pip<PYVERSION>`` commands behaves equally
|
||||
|
|
Loading…
Reference in a new issue