mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
query installed requirements for extras
fixes issue where egg_info('requires.txt') does not exist for packages installed from wheels.
This commit is contained in:
parent
3968856c60
commit
c2e71e7ce6
|
@ -54,6 +54,9 @@
|
||||||
* Fixed :issue:`1101`. Properly handle an index or --find-links target which
|
* Fixed :issue:`1101`. Properly handle an index or --find-links target which
|
||||||
has a <base> without a href attribute. (:pull:`1869`)
|
has a <base> without a href attribute. (:pull:`1869`)
|
||||||
|
|
||||||
|
* Fixed :issue:`1885`. Will properly handle extras when a project is installed
|
||||||
|
via Wheel. (:pull:`1896`)
|
||||||
|
|
||||||
|
|
||||||
**1.5.7**
|
**1.5.7**
|
||||||
|
|
||||||
|
|
|
@ -451,6 +451,10 @@ exec(compile(
|
||||||
_requirements_section_re = re.compile(r'\[(.*?)\]')
|
_requirements_section_re = re.compile(r'\[(.*?)\]')
|
||||||
|
|
||||||
def requirements(self, extras=()):
|
def requirements(self, extras=()):
|
||||||
|
if self.satisfied_by:
|
||||||
|
for r in self.satisfied_by.requires(extras):
|
||||||
|
yield str(r)
|
||||||
|
return
|
||||||
in_extra = None
|
in_extra = None
|
||||||
for line in self.egg_info_lines('requires.txt'):
|
for line in self.egg_info_lines('requires.txt'):
|
||||||
match = self._requirements_section_re.match(line.lower())
|
match = self._requirements_section_re.match(line.lower())
|
||||||
|
|
|
@ -84,6 +84,8 @@ meta-1.0-py2.py3-none-any.whl
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
Is an empty package which install_requires the simple and simple2 packages.
|
Is an empty package which install_requires the simple and simple2 packages.
|
||||||
|
|
||||||
|
requires_simple_extra-0.1-py2.py3-none-any.whl
|
||||||
|
----------------------------------------------
|
||||||
|
requires_simple_extra[extra] requires simple==1.0
|
||||||
|
|
||||||
|
|
||||||
|
|
Binary file not shown.
2
tests/data/src/requires_simple_extra/setup.cfg
Normal file
2
tests/data/src/requires_simple_extra/setup.cfg
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[wheel]
|
||||||
|
universal=1
|
9
tests/data/src/requires_simple_extra/setup.py
Normal file
9
tests/data/src/requires_simple_extra/setup.py
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
from setuptools import setup
|
||||||
|
|
||||||
|
setup(name='requires_simple_extra',
|
||||||
|
version='0.1',
|
||||||
|
py_modules = ['requires_simple_extra'],
|
||||||
|
extras_require = {
|
||||||
|
'extra' : ['simple==1.0']
|
||||||
|
}
|
||||||
|
)
|
|
@ -12,6 +12,25 @@ def test_simple_extras_install_from_pypi(script):
|
||||||
assert initools_folder in result.files_created, result.files_created
|
assert initools_folder in result.files_created, result.files_created
|
||||||
|
|
||||||
|
|
||||||
|
def test_extras_after_wheel(script, data):
|
||||||
|
"""
|
||||||
|
Test installing a package with extras after installing from a wheel.
|
||||||
|
"""
|
||||||
|
simple = script.site_packages / 'simple'
|
||||||
|
|
||||||
|
no_extra = script.pip(
|
||||||
|
'install', '--no-index', '-f', data.find_links,
|
||||||
|
'requires_simple_extra', expect_stderr=True,
|
||||||
|
)
|
||||||
|
assert simple not in no_extra.files_created, no_extra.files_created
|
||||||
|
|
||||||
|
extra = script.pip(
|
||||||
|
'install', '--no-index', '-f', data.find_links,
|
||||||
|
'requires_simple_extra[extra]', expect_stderr=True,
|
||||||
|
)
|
||||||
|
assert simple in extra.files_created, extra.files_created
|
||||||
|
|
||||||
|
|
||||||
def test_no_extras_uninstall(script):
|
def test_no_extras_uninstall(script):
|
||||||
"""
|
"""
|
||||||
No extras dependency gets uninstalled when the root package is uninstalled
|
No extras dependency gets uninstalled when the root package is uninstalled
|
||||||
|
|
Loading…
Reference in a new issue