Browse Source

Добавлена фильтрация default_opts

tags/3.2.0_beta1
Mike Khiretskiy 7 years ago
parent
commit
d8cbd1c6e8
2 changed files with 19 additions and 6 deletions
  1. +11
    -2
      update/emerge_parser.py
  2. +8
    -4
      update/update.py

+ 11
- 2
update/emerge_parser.py View File

@@ -102,12 +102,21 @@ class EmergeCommand(CommandExecutor):
cmd = getProgPath("/usr/bin/emerge")

def __init__(self, packages, extra_params=None, env=None, cwd=None,
logfile=None):
logfile=None, emerge_default_opts=None):
extra_params = extra_params or []
self.child = None
self.packages = packages
self.params = self.default_params + extra_params
default_env = {'CLEAN_DELAY': '0'}
wrong_default_opts = ("--columns","--ask ", "--ask=")
if emerge_default_opts is None:
default_env = {'CLEAN_DELAY': '0'}
else:
default_env = {
'CLEAN_DELAY': '0',
'EMERGE_DEFAULT_OPTS': " ".join(filter(
lambda x: not any(y in x for y in wrong_default_opts),
emerge_default_opts))
}
default_env.update(os.environ)
self.env = env or default_env
self.cwd = cwd


+ 8
- 4
update/update.py View File

@@ -533,6 +533,7 @@ class Update:
"""
Вывести информацию об обновлении
"""
deo = self.clVars.Get('cl_emerge_default_opts')
param, packages = self.getCacheOnWorld(param, packages, check=True)
param = [param, "-pv"]

@@ -540,8 +541,8 @@ class Update:
self.printSUCCESS(_("Installed packages are up to date"))
self.set_need_update(False)
return True
with EmergeParser(EmergeCommand(list(packages),
extra_params=param)) as emerge:
with EmergeParser(EmergeCommand(list(packages), emerge_default_opts=deo,
extra_params=param)) as emerge:
try:
emerge.run()
if "@world" in packages:
@@ -623,6 +624,7 @@ class Update:
"""
Выполнить сборку пакета
"""
deo = self.clVars.Get('cl_emerge_default_opts')
if not packages:
packages = [param]
extra_params = None
@@ -631,7 +633,7 @@ class Update:
if not packages:
return True
extra_params = [param]
with EmergeParser(EmergeCommand(list(packages),
with EmergeParser(EmergeCommand(list(packages), emerge_default_opts=deo,
extra_params=extra_params)) as emerge:
try:
emerge.question.action = lambda x: False
@@ -649,7 +651,9 @@ class Update:
"""
Выполнить очистку системы от лишних пакетов
"""
with EmergeParser(EmergeCommand(["--depclean"])) as emerge:
deo = self.clVars.Get('cl_emerge_default_opts')
with EmergeParser(EmergeCommand(["--depclean"],
emerge_default_opts=deo)) as emerge:
try:
emerge.question.action = lambda x: False
emerge.run()


Loading…
Cancel
Save