diff --git a/install/distr.py b/install/distr.py index be23d8e..545168b 100644 --- a/install/distr.py +++ b/install/distr.py @@ -458,7 +458,7 @@ class Distributive(object): PartitionDistributive:"partdir"} extname = mapExtName.get(distr.__class__,"") image = distr.convertToDirectory() - except Exception,e: + except Exception as e: if distr: distr.close() return {}.copy() diff --git a/install/variables/X11.py b/install/variables/X11.py index cd8ef73..3634b02 100644 --- a/install/variables/X11.py +++ b/install/variables/X11.py @@ -26,6 +26,7 @@ from calculate.lib.utils.common import (getVideoFromXorgLog, getAvailableVideo, getValueFromCmdLine, getCompositeFromXorgconf, getVideoFromModules, getVideoFromVendor,getInstalledVideo) +from calculate.install.distr import DistributiveError from calculate.lib.cl_lang import setLocalTranslate setLocalTranslate('cl_install3',sys.modules[__name__]) @@ -109,10 +110,13 @@ class VariableOsInstallX11VideoAvailable(VideoVariable): image = self.Get('cl_image') if image: with image as distr: - distrPath = image.getDirectory() - if isPkgInstalled('xorg-server',prefix=distrPath): - return sorted(filter(self.supported.__contains__, - getAvailableVideo(prefix=distrPath)))+['other'] + try: + distrPath = image.getDirectory() + if isPkgInstalled('xorg-server',prefix=distrPath): + return sorted(filter(self.supported.__contains__, + getAvailableVideo(prefix=distrPath)))+['other'] + except DistributiveError as e: + pass return [] class VariableOsX11KmsVideoDrv(ReadonlyVariable): diff --git a/install/variables/kernel.py b/install/variables/kernel.py index 9f8c395..2e844ac 100644 --- a/install/variables/kernel.py +++ b/install/variables/kernel.py @@ -30,6 +30,7 @@ from calculate.lib.utils.common import (getKernelUid,getTupleVersion, getValueFromCmdLine) from calculate.lib.utils.device import getUdevDeviceInfo from itertools import * +from calculate.install.distr import DistributiveError class VariableOsInstallKernelScheduler(Variable): """ @@ -85,11 +86,14 @@ class VariableOsInstallKernelBfqSet(ReadonlyVariable): image = self.Get('cl_image') if image: with image as distr: - distrPath = image.getDirectory() - kernelConfig = path.join(distrPath,"usr/src/linux/.config") - if filter(lambda x:"CONFIG_IOSCHED_BFQ=y" in x, - readLinesFile(kernelConfig)): - return "on" + try: + distrPath = image.getDirectory() + kernelConfig = path.join(distrPath,"usr/src/linux/.config") + if filter(lambda x:"CONFIG_IOSCHED_BFQ=y" in x, + readLinesFile(kernelConfig)): + return "on" + except DistributiveError as e: + return "off" return "off" class VariableOsInstallKernelAttr(Variable): diff --git a/install/variables/net.py b/install/variables/net.py index a7f2df2..d5cec22 100644 --- a/install/variables/net.py +++ b/install/variables/net.py @@ -35,6 +35,7 @@ from calculate.lib.utils.portage import isPkgInstalled from operator import itemgetter from itertools import * import hashlib +from calculate.install.distr import DistributiveError class NetHelper: """ @@ -649,11 +650,14 @@ class VariableOsInstallNetConfAvailable(NetHelper,Variable): image = self.Get('cl_image') if image: with image as distr: - distrPath = image.getDirectory() - return map(itemgetter(0,2), - filter(lambda x:not x[1] or isPkgInstalled(x[1], - prefix=distrPath), - mapNetConf)) + try: + distrPath = image.getDirectory() + return map(itemgetter(0,2), + filter(lambda x:not x[1] or isPkgInstalled(x[1], + prefix=distrPath), + mapNetConf)) + except DistributiveError as e: + pass return sorted(map(itemgetter(0,2),mapNetConf[-1:]),key=itemgetter(1)) class VariableOsInstallNetConf(NetHelper,Variable):