Merge branch 'master' of calculate.ru:/calculate-lib

develop
Самоукин Алексей 14 years ago
commit e245d3ff57

@ -65,7 +65,7 @@ class fillVars(varsShare):
textLines = self._runos("hostname -d 2>&1")
if textLines is False:
cl_overriding.printERROR(_("Error execute 'hostname -d'"))
cl_overriding.exit(1)
return cl_overriding.exit(1)
domain = ""
if textLines:
domain = textLines[0]
@ -74,7 +74,7 @@ class fillVars(varsShare):
_("Not found domain name"))
cl_overriding.printERROR(\
_("Command 'hostname -d' returns an empty value"))
cl_overriding.exit(1)
return cl_overriding.exit(1)
elif re.search("^hostname: ",domain):
return "local"
else:

@ -516,6 +516,8 @@ def removeDir(rmDir):
def getRunCommands():
"""List run program"""
if not os.access('/proc',os.R_OK):
return []
return map(lambda x:open('/proc/%s/cmdline'%x).read().strip(),
filter(lambda x:x.isdigit(),
os.listdir('/proc')))
@ -523,10 +525,13 @@ def getRunCommands():
def isMount(path):
"""В случае монтирования директории выдает другой примонтированный путь"""
absPath = os.path.abspath(path)
mtabFile = '/etc/mtab'
if not os.access(mtabFile,os.R_OK):
return ""
return filter(lambda x: x!=absPath,
reduce(lambda x,y: y, filter(lambda x: absPath in x,
map(lambda x: [x[0], x[1]], map(lambda x: x.split(" "),
open("/etc/mtab")))),[""]))[0]
open(mtabFile)))),[""]))[0]
def pathJoin(*paths):
"""Складывает пути, в отличии от os.path.join, складывает абсолютные пути"""

Loading…
Cancel
Save