|
|
|
@ -22,7 +22,8 @@ import re
|
|
|
|
|
import sys
|
|
|
|
|
import traceback
|
|
|
|
|
from os.path import exists as pathexists,join as pathjoin
|
|
|
|
|
from cl_utils import runOsCommand
|
|
|
|
|
from cl_utils import runOsCommand,appendProgramToEnvFile, \
|
|
|
|
|
removeProgramToEnvFile
|
|
|
|
|
|
|
|
|
|
import cl_overriding
|
|
|
|
|
|
|
|
|
@ -580,7 +581,6 @@ class convertDictOpt:
|
|
|
|
|
|
|
|
|
|
class cl_install(color_print):
|
|
|
|
|
"""Primary class for templates appling and system installation"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
|
self.clVars = None
|
|
|
|
@ -1161,16 +1161,19 @@ class cl_install(color_print):
|
|
|
|
|
self.printRight(self.lenString(message)+5,4)
|
|
|
|
|
self.startMessage = True
|
|
|
|
|
|
|
|
|
|
def printByResult(self,result):
|
|
|
|
|
def printByResult(self,result,failMessage=None):
|
|
|
|
|
if result:
|
|
|
|
|
self.printLine((('blueBr','['),
|
|
|
|
|
('greenBr',' ok '),
|
|
|
|
|
('blueBr',']')),[],printBR=False)
|
|
|
|
|
self.defaultPrint("")
|
|
|
|
|
else:
|
|
|
|
|
self.printLine((('blueBr','['),
|
|
|
|
|
('redBr',' !! '),
|
|
|
|
|
('blueBr',']')),[],printBR=False)
|
|
|
|
|
self.defaultPrint("")
|
|
|
|
|
self.defaultPrint("")
|
|
|
|
|
if failMessage:
|
|
|
|
|
self.printERROR(failMessage)
|
|
|
|
|
self.startMessage = False
|
|
|
|
|
|
|
|
|
|
def setupOpenGL(self):
|
|
|
|
@ -1459,3 +1462,80 @@ the system") + " (yes/no)"
|
|
|
|
|
self.clVars.Set('os_install_locale_xkb',
|
|
|
|
|
locale.getFieldByLang('xkblayout',lang), True)
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def installOverlay(self):
|
|
|
|
|
return True
|
|
|
|
|
#res,mes = runOsCommand('layman -l -N')
|
|
|
|
|
#notempty = lambda x:x
|
|
|
|
|
|
|
|
|
|
#if res == 0:
|
|
|
|
|
#
|
|
|
|
|
# map(lambda x:x[0],
|
|
|
|
|
# filter(lambda x:x,
|
|
|
|
|
# map(lambda x:filter(lambda x:x,x.split())[1:2],
|
|
|
|
|
# mes)))
|
|
|
|
|
# return True
|
|
|
|
|
#else:
|
|
|
|
|
# raise InstallError(_("Cann't get list layman overlays"))
|
|
|
|
|
|
|
|
|
|
def installPackage(self):
|
|
|
|
|
"""Install this package. Convert Gentoo system to Calculate"""
|
|
|
|
|
error = None
|
|
|
|
|
self.printSUCCESS(_('Package installation'))
|
|
|
|
|
try:
|
|
|
|
|
self.printMessageForTest(
|
|
|
|
|
_("Link calculate-install to package configuration"))
|
|
|
|
|
self.printByResult(appendProgramToEnvFile(__app__, self.clVars),
|
|
|
|
|
failMessage=
|
|
|
|
|
_("Can not save '%s' to %s")%(__app__,
|
|
|
|
|
self.clVars.Get("cl_env_path")[0]))
|
|
|
|
|
except (InstallError,DistributiveError),e:
|
|
|
|
|
error = e
|
|
|
|
|
except (Exception),e:
|
|
|
|
|
error = ""
|
|
|
|
|
for i in apply(traceback.format_exception, sys.exc_info()):
|
|
|
|
|
error += i
|
|
|
|
|
except KeyboardInterrupt,e:
|
|
|
|
|
if self.startMessage:
|
|
|
|
|
self.printByResult(False)
|
|
|
|
|
self.defaultPrint("\n")
|
|
|
|
|
error = _("Package installation manually interrupt")
|
|
|
|
|
if self.startMessage:
|
|
|
|
|
self.printByResult(False)
|
|
|
|
|
if error:
|
|
|
|
|
for line in filter(lambda x: x,str(error).split('\n')):
|
|
|
|
|
self.printERROR(line)
|
|
|
|
|
self.printERROR(_("Package installation failed"))
|
|
|
|
|
return False
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def uninstallPackage(self):
|
|
|
|
|
"""Uninstall this package. Convert Calculate system to Gentoo"""
|
|
|
|
|
error = None
|
|
|
|
|
self.printSUCCESS(_('Package uninstallation'))
|
|
|
|
|
try:
|
|
|
|
|
self.printMessageForTest(
|
|
|
|
|
_("Unlink calculate-install from package configuration"))
|
|
|
|
|
self.printByResult(removeProgramToEnvFile(__app__, self.clVars),
|
|
|
|
|
failMessage=
|
|
|
|
|
_("Can not remove '%s' to %s")%(__app__,
|
|
|
|
|
self.clVars.Get("cl_env_path")[0]))
|
|
|
|
|
except (InstallError,DistributiveError),e:
|
|
|
|
|
error = e
|
|
|
|
|
except (Exception),e:
|
|
|
|
|
error = ""
|
|
|
|
|
for i in apply(traceback.format_exception, sys.exc_info()):
|
|
|
|
|
error += i
|
|
|
|
|
except KeyboardInterrupt,e:
|
|
|
|
|
if self.startMessage:
|
|
|
|
|
self.printByResult(False)
|
|
|
|
|
self.defaultPrint("\n")
|
|
|
|
|
error = _("Package uninstallation manually interrupt")
|
|
|
|
|
if self.startMessage:
|
|
|
|
|
self.printByResult(False)
|
|
|
|
|
if error:
|
|
|
|
|
for line in filter(lambda x: x,str(error).split('\n')):
|
|
|
|
|
self.printERROR(line)
|
|
|
|
|
self.printERROR(_("Package uninstallation failed"))
|
|
|
|
|
return False
|
|
|
|
|
return True
|
|
|
|
|