mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
remove DistributionNotFound when no version is found
- and rely on if not applicable_versions test instead - fixes #2502 - rephrase the DistributionNotFound error message to fix other tests
This commit is contained in:
parent
e5b447b14f
commit
9dd1852c16
31
pip/index.py
31
pip/index.py
|
@ -421,31 +421,8 @@ class PackageFinder(object):
|
||||||
Returns an InstallationCandidate or None
|
Returns an InstallationCandidate or None
|
||||||
May raise DistributionNotFound or BestVersionAlreadyInstalled"""
|
May raise DistributionNotFound or BestVersionAlreadyInstalled"""
|
||||||
all_versions = self._find_all_versions(req)
|
all_versions = self._find_all_versions(req)
|
||||||
if not all_versions:
|
|
||||||
logger.critical(
|
|
||||||
'Could not find any downloads that satisfy the requirement %s',
|
|
||||||
req,
|
|
||||||
)
|
|
||||||
|
|
||||||
if self.need_warn_external:
|
|
||||||
logger.warning(
|
|
||||||
"Some externally hosted files were ignored as access to "
|
|
||||||
"them may be unreliable (use --allow-external %s to "
|
|
||||||
"allow).",
|
|
||||||
req.name,
|
|
||||||
)
|
|
||||||
|
|
||||||
if self.need_warn_unverified:
|
|
||||||
logger.warning(
|
|
||||||
"Some insecure and unverifiable files were ignored"
|
|
||||||
" (use --allow-unverified %s to allow).",
|
|
||||||
req.name,
|
|
||||||
)
|
|
||||||
|
|
||||||
raise DistributionNotFound(
|
|
||||||
'No distributions at all found for %s' % req
|
|
||||||
)
|
|
||||||
# Filter out anything which doesn't match our specifier
|
# Filter out anything which doesn't match our specifier
|
||||||
|
|
||||||
_versions = set(
|
_versions = set(
|
||||||
req.specifier.filter(
|
req.specifier.filter(
|
||||||
[x.version for x in all_versions],
|
[x.version for x in all_versions],
|
||||||
|
@ -507,7 +484,9 @@ class PackageFinder(object):
|
||||||
if self.need_warn_external:
|
if self.need_warn_external:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"Some externally hosted files were ignored as access to "
|
"Some externally hosted files were ignored as access to "
|
||||||
"them may be unreliable (use --allow-external to allow)."
|
"them may be unreliable (use --allow-external %s to "
|
||||||
|
"allow).",
|
||||||
|
req.name,
|
||||||
)
|
)
|
||||||
|
|
||||||
if self.need_warn_unverified:
|
if self.need_warn_unverified:
|
||||||
|
@ -518,7 +497,7 @@ class PackageFinder(object):
|
||||||
)
|
)
|
||||||
|
|
||||||
raise DistributionNotFound(
|
raise DistributionNotFound(
|
||||||
'No distributions matching the version for %s' % req
|
'No matching distribution found for %s' % req
|
||||||
)
|
)
|
||||||
|
|
||||||
if applicable_versions[0].location is INSTALLED_VERSION:
|
if applicable_versions[0].location is INSTALLED_VERSION:
|
||||||
|
|
|
@ -739,3 +739,28 @@ def test_no_compiles_pyc(script, data):
|
||||||
)
|
)
|
||||||
|
|
||||||
assert not any(exists)
|
assert not any(exists)
|
||||||
|
|
||||||
|
|
||||||
|
def test_install_upgrade_editable_depending_on_other_editable(script):
|
||||||
|
script.scratch_path.join("pkga").mkdir()
|
||||||
|
pkga_path = script.scratch_path / 'pkga'
|
||||||
|
pkga_path.join("setup.py").write(textwrap.dedent("""
|
||||||
|
from setuptools import setup
|
||||||
|
setup(name='pkga',
|
||||||
|
version='0.1')
|
||||||
|
"""))
|
||||||
|
script.pip('install', '--editable', pkga_path)
|
||||||
|
result = script.pip('list')
|
||||||
|
assert "pkga" in result.stdout
|
||||||
|
|
||||||
|
script.scratch_path.join("pkgb").mkdir()
|
||||||
|
pkgb_path = script.scratch_path / 'pkgb'
|
||||||
|
pkgb_path.join("setup.py").write(textwrap.dedent("""
|
||||||
|
from setuptools import setup
|
||||||
|
setup(name='pkgb',
|
||||||
|
version='0.1',
|
||||||
|
install_requires=['pkga'])
|
||||||
|
"""))
|
||||||
|
script.pip('install', '--upgrade', '--editable', pkgb_path)
|
||||||
|
result = script.pip('list')
|
||||||
|
assert "pkgb" in result.stdout
|
||||||
|
|
|
@ -13,7 +13,7 @@ def test_options_from_env_vars(script):
|
||||||
result = script.pip('install', '-vvv', 'INITools', expect_error=True)
|
result = script.pip('install', '-vvv', 'INITools', expect_error=True)
|
||||||
assert "Ignoring indexes:" in result.stdout, str(result)
|
assert "Ignoring indexes:" in result.stdout, str(result)
|
||||||
assert (
|
assert (
|
||||||
"DistributionNotFound: No distributions at all found for INITools"
|
"DistributionNotFound: No matching distribution found for INITools"
|
||||||
in result.stdout
|
in result.stdout
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ def _test_env_vars_override_config_file(script, virtualenv, config_file):
|
||||||
"""))
|
"""))
|
||||||
result = script.pip('install', '-vvv', 'INITools', expect_error=True)
|
result = script.pip('install', '-vvv', 'INITools', expect_error=True)
|
||||||
assert (
|
assert (
|
||||||
"DistributionNotFound: No distributions at all found for INITools"
|
"DistributionNotFound: No matching distribution found for INITools"
|
||||||
in result.stdout
|
in result.stdout
|
||||||
)
|
)
|
||||||
script.environ['PIP_NO_INDEX'] = '0'
|
script.environ['PIP_NO_INDEX'] = '0'
|
||||||
|
@ -184,6 +184,6 @@ def test_options_from_venv_config(script, virtualenv):
|
||||||
result = script.pip('install', '-vvv', 'INITools', expect_error=True)
|
result = script.pip('install', '-vvv', 'INITools', expect_error=True)
|
||||||
assert "Ignoring indexes:" in result.stdout, str(result)
|
assert "Ignoring indexes:" in result.stdout, str(result)
|
||||||
assert (
|
assert (
|
||||||
"DistributionNotFound: No distributions at all found for INITools"
|
"DistributionNotFound: No matching distribution found for INITools"
|
||||||
in result.stdout
|
in result.stdout
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue