[+] add pip_check_conflicts
This commit is contained in:
parent
a5818c70d9
commit
075b1b6149
@ -4012,6 +4012,28 @@ class Command(enum.StrEnum):
|
|||||||
vpn = 'vpn'
|
vpn = 'vpn'
|
||||||
backup = 'backup'
|
backup = 'backup'
|
||||||
pip_resolve = 'pip_resolve'
|
pip_resolve = 'pip_resolve'
|
||||||
|
pip_check_conflicts = 'pip_check_conflicts'
|
||||||
|
|
||||||
|
def pip_check_conflicts(
|
||||||
|
args: list[str],
|
||||||
|
) -> None:
|
||||||
|
from .commands_typed.pip import pip_check_conflicts
|
||||||
|
from .commands_typed.argparse import parse_args as pr34_parse_args
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument(
|
||||||
|
'-p',
|
||||||
|
dest='venv_path',
|
||||||
|
type=pathlib.Path,
|
||||||
|
help='venv path',
|
||||||
|
default=None,
|
||||||
|
)
|
||||||
|
|
||||||
|
options, argv = pr34_parse_args(parser, args)
|
||||||
|
|
||||||
|
res = pip_check_conflicts(options.venv_path)
|
||||||
|
logger.info(dict(res=res))
|
||||||
|
|
||||||
|
assert res.status == 'ok'
|
||||||
|
|
||||||
def pip_resolve(
|
def pip_resolve(
|
||||||
args: list[str],
|
args: list[str],
|
||||||
@ -4154,6 +4176,8 @@ def commands_cli(
|
|||||||
desktop_services(args)
|
desktop_services(args)
|
||||||
elif options.command is Command.pip_resolve:
|
elif options.command is Command.pip_resolve:
|
||||||
pip_resolve(args)
|
pip_resolve(args)
|
||||||
|
elif options.command is Command.pip_check_conflicts:
|
||||||
|
pip_check_conflicts(args)
|
||||||
elif options.command is Command.pm_service:
|
elif options.command is Command.pm_service:
|
||||||
pm_service(args)
|
pm_service(args)
|
||||||
elif options.command is Command.backup:
|
elif options.command is Command.backup:
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import contextlib
|
import contextlib
|
||||||
|
import glob
|
||||||
import pathlib
|
import pathlib
|
||||||
import sys
|
import sys
|
||||||
import enum
|
import enum
|
||||||
@ -522,3 +523,42 @@ def pip_resolve(
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
class pip_check_conflicts_t:
|
||||||
|
@dataclasses.dataclass
|
||||||
|
class res_t:
|
||||||
|
status : Literal['ok', 'error']
|
||||||
|
duplicates: list[str]
|
||||||
|
|
||||||
|
def pip_check_conflicts(
|
||||||
|
venv_path: Optional[pathlib.Path] = None,
|
||||||
|
) -> pip_check_conflicts_t.res_t:
|
||||||
|
assert sys.platform == 'linux'
|
||||||
|
if venv_path is None:
|
||||||
|
venv_path = pathlib.Path(
|
||||||
|
sys.executable,
|
||||||
|
).parent / '..'
|
||||||
|
|
||||||
|
# records = glob.glob(
|
||||||
|
# str(venv_path / '*' / 'site-packages' / '*.dist-info' / 'RECORD'),
|
||||||
|
# recursive=True,
|
||||||
|
# )
|
||||||
|
|
||||||
|
duplicates = [
|
||||||
|
line
|
||||||
|
for line in subprocess.check_output(r'''
|
||||||
|
cat $(find $VENV_PATH/lib/*/*/*.dist-info/RECORD) | sort | uniq -c | (grep -v -P '^\s+1\s'; true;)
|
||||||
|
''', shell=True, env=dict(
|
||||||
|
VENV_PATH=str(venv_path),
|
||||||
|
)).decode('utf-8').splitlines()
|
||||||
|
if line.strip() != ''
|
||||||
|
]
|
||||||
|
|
||||||
|
return pip_check_conflicts_t.res_t(
|
||||||
|
status=(
|
||||||
|
'error'
|
||||||
|
if len(duplicates) > 0
|
||||||
|
else 'ok'
|
||||||
|
),
|
||||||
|
duplicates=duplicates
|
||||||
|
)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = 'online.fxreader.pr34'
|
name = 'online.fxreader.pr34'
|
||||||
version = '0.1.5.16+27.6'
|
version = '0.1.5.16+27.7'
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
#"-r requirements.txt",
|
#"-r requirements.txt",
|
||||||
|
BIN
releases/whl/online_fxreader_pr34-0.1.5.16+27.7-py3-none-any.whl
(Stored with Git LFS)
Normal file
BIN
releases/whl/online_fxreader_pr34-0.1.5.16+27.7-py3-none-any.whl
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user