Add python var and lib var

legacy27 3.6.6.1
Mike Hiretsky 4 years ago
parent 8a7ce50e97
commit 4456a88895

@ -21,8 +21,10 @@ from itertools import *
from calculate.lib.datavars import (TableVariable, Variable, ReadonlyVariable,
VariableError, ReadonlyTableVariable,
FieldValue, HumanReadable)
from calculate.lib.utils.files import listDirectory, process, PIPE, pathJoin
from calculate.lib.utils.portage import isPkgInstalled, RepositoryPath
from calculate.lib.utils.files import (listDirectory, process, PIPE, pathJoin,
readFileEx)
from calculate.lib.utils.portage import (isPkgInstalled, RepositoryPath,
getInstalledAtom)
from calculate.lib.utils.common import cmpVersion
from calculate.lib.datavars import DataVars
from itertools import dropwhile
@ -796,3 +798,37 @@ class VariableClClientType(ReadonlyVariable):
Тип клиента получающего информацию от core
"""
value = ""
class VariableOsLibPath(ReadonlyVariable):
"""
Использовать lib или lib64
"""
def get(self):
if self.Get('os_arch_machine') == 'x86_64':
return "lib64"
else:
return "lib"
class VariableOsPython(ReadonlyVariable):
"""
Путь до модулей синхронизации
"""
def get_root(self):
return "/"
def get_usrlib(self):
return "/usr/%s" % self.Get('os_lib_path')
def get(self):
chroot_path = self.get_root()
pythons = readFileEx(pathJoin(chroot_path,
"/etc/python-exec/python-exec.conf"), grab=True).split()
if pythons:
for python in pythons:
libpath = self.get_usrlib()
if path.exists(pathJoin(chroot_path, libpath, python)):
return python
for atom in sorted(
getInstalledAtom("dev-lang/python",prefix=chroot_path),
reverse=True):
return "python{SLOT}".format(**atom)

Loading…
Cancel
Save