From 877bc565bee0a97c5c79d94b87eceafade8fca66 Mon Sep 17 00:00:00 2001 From: asamoukin Date: Tue, 26 May 2009 07:23:51 +0000 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D0=BD=D0=BE=D0=B2=D1=8B=D0=B5=20=D0=BF=D0=B5?= =?UTF-8?q?=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=BD=D1=8B=D0=B5=20=D0=BF=D1=80?= =?UTF-8?q?=D0=BE=D1=84=D0=B8=D0=BB=D1=8F:=20os=5Flinux=5Fname=20-=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=BB=D0=BD=D0=BE=D0=B5=20=D0=BD=D0=B0=D0=B7=D0=B2?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D0=B5=20=D1=81=D0=B8=D1=81=D1=82=D0=B5=D0=BC?= =?UTF-8?q?=D1=8B=20os=5Flinux=5Fsubname=20-=20=D0=BF=D0=BE=D1=81=D0=BB?= =?UTF-8?q?=D0=B5=D0=B4=D0=BD=D1=8F=D1=8F=20=D1=87=D0=B0=D1=81=D1=82=D1=8C?= =?UTF-8?q?=20=D0=BD=D0=B0=D0=B7=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20=D1=81?= =?UTF-8?q?=D0=B8=D1=81=D1=82=D0=B5=D0=BC=D1=8B=20os=5Flinux=5Fver=20-=20?= =?UTF-8?q?=D0=B2=D0=B5=D1=80=D1=81=D0=B8=D1=8F=20=D1=81=D0=B8=D1=81=D1=82?= =?UTF-8?q?=D0=B5=D0=BC=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://svn.calculate.ru/calculate2/calculate-lib/trunk@1514 c91db197-33c1-4113-bf15-f8a5c547ca64 --- pym/cl_fill.py | 41 +++++++++++++++++++++++++++++++++++++++++ pym/cl_vars.py | 11 ++++++++++- 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/pym/cl_fill.py b/pym/cl_fill.py index 0872393..08bd994 100644 --- a/pym/cl_fill.py +++ b/pym/cl_fill.py @@ -50,6 +50,47 @@ class fillVars(object, cl_base.glob_attr): return shortNameList[0] return "CLD" + def get_os_linux_name(self): + """полное название системы""" + linuxShortName = self.Get("os_linux_shortname") + if linuxShortName: + dictLinuxName = {"CLD":"Calculate Linux Desktop", + "CLDX":"Calculate Linux Desktop", + "CDS":"Calculate Directory Server"} + if linuxShortName in dictLinuxName.keys(): + return dictLinuxName[linuxShortName] + else: + return "" + else: + return "" + + def get_os_linux_subname(self): + """постфикс к названию системы""" + linuxShortName = self.Get("os_linux_shortname") + if linuxShortName: + dictLinuxSubName = {"CLD":"KDE", "CLDX":"XFCE"} + if linuxShortName in dictLinuxSubName.keys(): + return dictLinuxSubName[linuxShortName] + else: + return "" + else: + return "" + + def get_os_linux_ver(self): + '''Получить версию системы''' + path = '/etc/calculate/calculate.ini' + if os.path.exists(path): + FD = open(path) + data = FD.readlines() + FD.close() + shortNameList = filter(lambda y:y, + map(lambda x:\ + len(x.split("="))==2 and\ + x.split("=")[0]=="linuxver" and\ + x.split("=")[1].strip(), data)) + if shortNameList: + return shortNameList[0] + return "" def get_os_net_hostname(self): '''Считать имя компьютера net_host''' diff --git a/pym/cl_vars.py b/pym/cl_vars.py index 2334cbc..714ea49 100644 --- a/pym/cl_vars.py +++ b/pym/cl_vars.py @@ -71,4 +71,13 @@ class Data: os_root_dev = {} # тип носителя (ram, hdd, usb-hdd, livecd) - os_root_type = {} \ No newline at end of file + os_root_type = {} + + # полное название системы + os_linux_name = {} + + # постфикс к названию системы + os_linux_subname = {} + + # версия системы + os_linux_ver = {}