1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

Remove useless python packages from required_cap

Rename stub package required_by_mixed_cap to requires_requires_cap
Move the canonicalize_name calculation outside of a loop
This commit is contained in:
ofrinevo 2019-09-03 20:46:28 +03:00
parent 6da50d089d
commit 1c4881157e
8 changed files with 14 additions and 20 deletions

View file

@ -68,9 +68,10 @@ def search_packages_info(query):
logger.warning('Package(s) not found: %s', ', '.join(missing))
def get_requiring_packages(package_name):
canonical_name = canonicalize_name(package_name)
return [
pkg.project_name for pkg in pkg_resources.working_set
if canonicalize_name(package_name) in
if canonical_name in
[canonicalize_name(required.name) for required in
pkg.requires()]
]

View file

@ -1,5 +0,0 @@
from setuptools import setup
setup(name='Required_By_Capitalized',
version='1.0',
)

View file

@ -1,6 +0,0 @@
from setuptools import setup
setup(name='simple',
version='1.0',
install_requires=['required_by_Capitalized==1.0']
)

View file

@ -0,0 +1,6 @@
from setuptools import setup
setup(name='requires_requires_capitalized',
version='1.0',
install_requires=['requires_Capitalized==0.1']
)

View file

@ -244,17 +244,18 @@ def test_show_required_by_packages_requiring_capitalized(script, data):
where the package has a name with a mix of
lower and upper case letters
"""
required_package_path = os.path.join(data.src, 'required_by_capitalized')
required_package_path = os.path.join(data.src, 'requires_capitalized')
script.pip(
'install', '--no-index', '-f', data.find_links, required_package_path
)
editable_path = os.path.join(data.src, 'required_by_mixed_capitalization')
editable_path = os.path.join(data.src, 'requires_requires_capitalized')
script.pip(
'install', '--no-index', '-f', data.find_links, editable_path
)
result = script.pip('show', 'Required_By_Capitalized')
result = script.pip('show', 'Requires_Capitalized')
lines = result.stdout.splitlines()
print(lines)
assert 'Name: Required-By-Capitalized' in lines
assert 'Required-by: simple' in lines
assert 'Name: Requires-Capitalized' in lines
assert 'Required-by: requires-requires-capitalized' in lines