|
|
|
@ -34,7 +34,7 @@ from calculate.install.distr import (Distributive, PartitionDistributive,
|
|
|
|
|
|
|
|
|
|
from calculate.lib.cl_lang import setLocalTranslate, _
|
|
|
|
|
from calculate.install.fs_manager import FileSystemManager
|
|
|
|
|
from functools import reduce
|
|
|
|
|
from functools import reduce, cmp_to_key
|
|
|
|
|
|
|
|
|
|
setLocalTranslate('cl_install3', sys.modules[__name__])
|
|
|
|
|
|
|
|
|
@ -168,6 +168,7 @@ class DistroRepository(Linux):
|
|
|
|
|
# join files lists to one list
|
|
|
|
|
return [x for x in reduce(lambda x, y: x + y, allFiles, []) if distfilter(x)]
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
|
def extcomparator(self, *exts):
|
|
|
|
|
"""Compare extensions"""
|
|
|
|
|
mapExts = {'iso': 0,
|
|
|
|
@ -175,9 +176,16 @@ class DistroRepository(Linux):
|
|
|
|
|
'isodir': -2,
|
|
|
|
|
'partdir': -3,
|
|
|
|
|
'dir': -4}
|
|
|
|
|
return cmp(mapExts.get(exts[0], -4), mapExts.get(exts[1], -4))
|
|
|
|
|
|
|
|
|
|
# return cmp(mapExts.get(exts[0], -4), mapExts.get(exts[1], -4))
|
|
|
|
|
#no cmp in python3, instead do (a > b) - (a < b)
|
|
|
|
|
return (mapExts.get(exts[0], -4) > mapExts.get(exts[1], -4)) - \
|
|
|
|
|
(mapExts.get(exts[0], -4) < mapExts.get(exts[1], -4))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def sortdistrfunc(self, x, y):
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
|
def sortdistrfunc(x, y):
|
|
|
|
|
"""Func of comparing two distributive"""
|
|
|
|
|
ver1, ver2 = x[1].get('os_linux_ver', ""), y[1].get('os_linux_ver', "")
|
|
|
|
|
if ver1 and ver2 and ver1 != "0" and ver2 != "0" and ver1 != ver2:
|
|
|
|
@ -193,7 +201,7 @@ class DistroRepository(Linux):
|
|
|
|
|
return cmp(int(ser1), int(ser2))
|
|
|
|
|
ext1 = x[1].get('ext', "")
|
|
|
|
|
ext2 = y[1].get('ext', "")
|
|
|
|
|
return self.extcomparator(ext1, ext2)
|
|
|
|
|
return DistroRepository.extcomparator(ext1, ext2)
|
|
|
|
|
|
|
|
|
|
def getAvailableDristibutives(self, dirs, system=None, shortname=None,
|
|
|
|
|
march=None, version=None, build=None,
|
|
|
|
@ -204,10 +212,10 @@ class DistroRepository(Linux):
|
|
|
|
|
availDistrs = self._getAvailableDistributives(dirs, system, shortname,
|
|
|
|
|
march, version,
|
|
|
|
|
build)
|
|
|
|
|
availDistrs = [x for x
|
|
|
|
|
availDistrs = (x for x
|
|
|
|
|
in [(y, self._getDistrInfo(y)) for y in availDistrs]
|
|
|
|
|
if x[1] and "ext" in x[1] and not x[1]["ext"] in discardType]
|
|
|
|
|
return [x[0] for x in sorted(availDistrs, self.sortdistrfunc, reverse=True)]
|
|
|
|
|
if x[1] and "ext" in x[1] and not x[1]["ext"] in discardType)
|
|
|
|
|
return [x[0] for x in sorted(availDistrs, key=cmp_to_key(DistroRepository.sortdistrfunc), reverse=True)]
|
|
|
|
|
|
|
|
|
|
def getBestDistributive(self, dirs, system=None, shortname=None, march=None,
|
|
|
|
|
version=None, build=None, discardType=()):
|
|
|
|
|