Skip to content

Commit 872341d

Browse files
committed
check: simplify code
No need to have the version in the key
1 parent 80e241e commit 872341d

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

pip/commands/check.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,13 @@ def run(self, options, args):
2020
missing_reqs_dict, incompatible_reqs_dict = check_requirements(dists)
2121

2222
for dist in dists:
23-
key = '%s==%s' % (dist.project_name, dist.version)
24-
25-
for requirement in missing_reqs_dict.get(key, []):
23+
for requirement in missing_reqs_dict.get(dist.key, []):
2624
logger.info(
2725
"%s %s requires %s, which is not installed.",
2826
dist.project_name, dist.version, requirement.project_name)
2927

30-
for requirement, actual in incompatible_reqs_dict.get(key, []):
28+
for requirement, actual in incompatible_reqs_dict.get(
29+
dist.key, []):
3130
logger.info(
3231
"%s %s has requirement %s, but you have %s %s.",
3332
dist.project_name, dist.version, requirement,

pip/operations/check.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,14 @@ def check_requirements(installed_dists):
55
incompatible_reqs_dict = {}
66

77
for dist in installed_dists:
8-
key = '%s==%s' % (dist.project_name, dist.version)
9-
108
missing_reqs = list(get_missing_reqs(dist, installed_dists))
119
if missing_reqs:
12-
missing_reqs_dict[key] = missing_reqs
10+
missing_reqs_dict[dist.key] = missing_reqs
1311

1412
incompatible_reqs = list(get_incompatible_reqs(
1513
dist, installed_dists))
1614
if incompatible_reqs:
17-
incompatible_reqs_dict[key] = incompatible_reqs
15+
incompatible_reqs_dict[dist.key] = incompatible_reqs
1816

1917
return (missing_reqs_dict, incompatible_reqs_dict)
2018

0 commit comments

Comments
 (0)