Mercurial > repos > shellac > sam_consensus_v3
comparison env/lib/python3.9/site-packages/pip/_internal/commands/check.py @ 0:4f3585e2f14b draft default tip
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author | shellac |
---|---|
date | Mon, 22 Mar 2021 18:12:50 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4f3585e2f14b |
---|---|
1 import logging | |
2 | |
3 from pip._internal.cli.base_command import Command | |
4 from pip._internal.cli.status_codes import ERROR, SUCCESS | |
5 from pip._internal.operations.check import ( | |
6 check_package_set, | |
7 create_package_set_from_installed, | |
8 ) | |
9 from pip._internal.utils.misc import write_output | |
10 from pip._internal.utils.typing import MYPY_CHECK_RUNNING | |
11 | |
12 logger = logging.getLogger(__name__) | |
13 | |
14 if MYPY_CHECK_RUNNING: | |
15 from optparse import Values | |
16 from typing import Any, List | |
17 | |
18 | |
19 class CheckCommand(Command): | |
20 """Verify installed packages have compatible dependencies.""" | |
21 | |
22 usage = """ | |
23 %prog [options]""" | |
24 | |
25 def run(self, options, args): | |
26 # type: (Values, List[Any]) -> int | |
27 | |
28 package_set, parsing_probs = create_package_set_from_installed() | |
29 missing, conflicting = check_package_set(package_set) | |
30 | |
31 for project_name in missing: | |
32 version = package_set[project_name].version | |
33 for dependency in missing[project_name]: | |
34 write_output( | |
35 "%s %s requires %s, which is not installed.", | |
36 project_name, version, dependency[0], | |
37 ) | |
38 | |
39 for project_name in conflicting: | |
40 version = package_set[project_name].version | |
41 for dep_name, dep_version, req in conflicting[project_name]: | |
42 write_output( | |
43 "%s %s has requirement %s, but you have %s %s.", | |
44 project_name, version, req, dep_name, dep_version, | |
45 ) | |
46 | |
47 if missing or conflicting or parsing_probs: | |
48 return ERROR | |
49 else: | |
50 write_output("No broken requirements found.") | |
51 return SUCCESS |