Browse Source

Добавлены маркеры для устанавливаемых пакетов

tags/3.2.0_alpha12
Mike Khiretskiy 7 years ago
parent
commit
4386c59d5e
2 changed files with 34 additions and 8 deletions
  1. +14
    -6
      update/package_tools.py
  2. +20
    -2
      update/update.py

+ 14
- 6
update/package_tools.py View File

@@ -658,13 +658,14 @@ class EmergeUpdateInfo(Mapping):
Информация об обновлении одного пакета
"""

install_info = "\[(binary|ebuild)[^\]]+\]"
install_info = "\[(binary|ebuild)([^\]]+)\]"
atom_info = r"\S+"
use_info = 'USE="[^"]+"'
prev_version = "\[([^\]]+)\]"
pkg_size = r"[\d,]+ \w+"

attrs = ['binary', 'REPLACING_VERSIONS', 'SIZE']
attrs = ['binary', 'REPLACING_VERSIONS', 'SIZE', 'new', 'newslot',
'updating', 'downgrading', 'reinstall']

def __init__(self, data):
self._data = data
@@ -675,9 +676,16 @@ class EmergeUpdateInfo(Mapping):
r = self.update_info.search(self._data)
if r:
self._info['binary'] = r.group(2) == 'binary'
self._package = EmergePackage(r.group(3))
self._info['REPLACING_VERSIONS'] = r.group(4) or ""
self._info['SIZE'] = r.group(6) or ""
install_flag = r.group(3)
self._info['newslot'] = "S" in install_flag
self._info['new'] = "N" in install_flag and not "S" in install_flag
self._info['updating'] = ("U" in install_flag and
not "D" in install_flag)
self._info['downgrading'] = "D" in install_flag
self._info['reinstall'] = "R" in install_flag
self._package = EmergePackage(r.group(4))
self._info['REPLACING_VERSIONS'] = r.group(5) or ""
self._info['SIZE'] = r.group(7) or ""

def __iter__(self):
return chain(EmergePackage.attrs, self.attrs)
@@ -725,7 +733,7 @@ class EmergeRemoveInfo(EmergeUpdateInfo):
"""
Информация об удалении одного пакета (в списке обновляемых пакетов)
"""
install_info = "\[(uninstall)[^\]]+\]"
install_info = "\[(uninstall)([^\]]+)\]"


class Eix:


+ 20
- 2
update/update.py View File

@@ -389,12 +389,28 @@ class Update:
ebuild_color = TextState.Colors.GREEN
binary_color = TextState.Colors.PURPLE
remove_color = TextState.Colors.LIGHT_RED
flag_map = {"updating":
_print.foreground(TextState.Colors.LIGHT_CYAN)("U"),
"reinstall":
_print.foreground(TextState.Colors.YELLOW)("rR"),
"new":
_print.foreground(TextState.Colors.LIGHT_GREEN)("N"),
"newslot":
_print.foreground(TextState.Colors.LIGHT_GREEN)("NS"),
"downgrading": (
_print.foreground(TextState.Colors.LIGHT_CYAN)("U") +
_print.foreground(TextState.Colors.LIGHT_BLUE)("D"))}
for pkg in sorted([PackageInformation.add_info(x) for x in
pkglist],
key=lambda y: y['CATEGORY/PN']):
install_flag = ""
if remove_list:
pkgcolor = _print.foreground(remove_color)
else:
for flag in flag_map:
if pkg[flag]:
install_flag = "(%s) " % flag_map[flag]
break
if self.is_binary_pkg(pkg):
pkgcolor = _print.foreground(binary_color)
else:
@@ -411,8 +427,10 @@ class Update:
else:
size = ""
mult = _print.bold("*")
self.printDefault(" {mult} {fullname}{shortname}{size}".format(
mult=mult, fullname=fullname, shortname=shortname, size=size))
self.printDefault(
" {mult} {fullname}{flag}{shortname}{size}".format(
mult=mult, fullname=fullname, shortname=shortname, size=size,
flag=install_flag))

def _display_install_package(self, emerge):
"""


Loading…
Cancel
Save