Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hhhrrrttt222111
GitHub Repository: hhhrrrttt222111/Dorkify
Path: blob/master/venv/Lib/site-packages/pip/_internal/commands/check.py
811 views
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 typing import List, Any
16
from optparse import Values
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
52
53