Browse Source

Добавлена проверка на emerge при запуске update

tags/3.2.0_alpha12
Mike Khiretskiy 7 years ago
parent
commit
c18456f459
1 changed files with 17 additions and 7 deletions
  1. +17
    -7
      update/update.py

+ 17
- 7
update/update.py View File

@@ -35,7 +35,7 @@ from package_tools import Git, Layman,\

Colors = TextState.Colors
from calculate.lib.utils.files import (getProgPath, STDOUT, removeDir,
PercentProgress, process)
PercentProgress, process, getRunCommands)
from calculate.lib.cl_lang import (setLocalTranslate, getLazyLocalTranslate,
RegexpLocalization, _)
import emerge_parser
@@ -115,24 +115,34 @@ class Update:
"""
Проверить повторный запуск
"""
update_running = lambda: any(os.getpid() != x
for x in search_worked_process('update', dv))
dv = self.clVars
if filter(lambda x: os.getpid() != x,
search_worked_process('update', dv)):
if update_running():
if not wait_update:
raise UpdateError(_("Update is already running. "
"Try to run later."))
else:
self.startTask(_("Waiting for another update to be complete"))

while filter(lambda x: os.getpid() != x,
search_worked_process('update', dv)):
while update_running():
self.pauseProcess()
while any(ifilter(lambda x: os.getpid() != x,
search_worked_process('update', dv))):
while update_running():
time.sleep(0.3)
self.resumeProcess()
time.sleep(random.random()*3)
self.endTask()

emerge_running = lambda: any("/usr/bin/emerge" in x
for x in getRunCommands())
if emerge_running():
if not wait_update:
raise UpdateError(_("Emerge is running. "
"Try to run later."))
else:
self.startTask(_("Waiting for emerge to be complete"))
while emerge_running():
time.sleep(1)
self.endTask()
return True



Loading…
Cancel
Save