Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
keewenaw
GitHub Repository: keewenaw/ethereum-wallet-cracker
Path: blob/main/test/lib/python3.9/site-packages/pip/_internal/commands/check.py
4804 views
1
import logging
2
from optparse import Values
3
from typing import List
4
5
from pip._internal.cli.base_command import Command
6
from pip._internal.cli.status_codes import ERROR, SUCCESS
7
from pip._internal.operations.check import (
8
check_package_set,
9
create_package_set_from_installed,
10
)
11
from pip._internal.utils.misc import write_output
12
13
logger = logging.getLogger(__name__)
14
15
16
class CheckCommand(Command):
17
"""Verify installed packages have compatible dependencies."""
18
19
usage = """
20
%prog [options]"""
21
22
def run(self, options: Values, args: List[str]) -> int:
23
24
package_set, parsing_probs = create_package_set_from_installed()
25
missing, conflicting = check_package_set(package_set)
26
27
for project_name in missing:
28
version = package_set[project_name].version
29
for dependency in missing[project_name]:
30
write_output(
31
"%s %s requires %s, which is not installed.",
32
project_name,
33
version,
34
dependency[0],
35
)
36
37
for project_name in conflicting:
38
version = package_set[project_name].version
39
for dep_name, dep_version, req in conflicting[project_name]:
40
write_output(
41
"%s %s has requirement %s, but you have %s %s.",
42
project_name,
43
version,
44
req,
45
dep_name,
46
dep_version,
47
)
48
49
if missing or conflicting or parsing_probs:
50
return ERROR
51
else:
52
write_output("No broken requirements found.")
53
return SUCCESS
54
55