本文整理汇总了Python中yali.sysutils.find_executable函数的典型用法代码示例。如果您正苦于以下问题:Python find_executable函数的具体用法?Python find_executable怎么用?Python find_executable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了find_executable函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: format
def format(self, partition):
self.preFormat(partition)
cmd_path = sysutils.find_executable("mke2fs")
if not cmd_path:
cmd_path = sysutils.find_executable("mkfs.ext3")
if not cmd_path:
e = "Command not found to format %s filesystem" %(self.name())
raise FSError, e
# bug 5616: ~100MB reserved-blocks-percentage
reserved_percentage = int(math.ceil(100.0 * 100.0 / partition.getMB()))
# Use hashed b-trees to speed up lookups in large directories
cmd = "%s -O dir_index -j -m %d %s" %(cmd_path,
reserved_percentage,
partition.getPath())
p = os.popen(cmd)
o = p.readlines()
if p.close():
raise YaliException, "ext3 format failed: %s" % partition.getPath()
# for Disabling Lengthy Boot-Time Checks
self.tune2fs(partition)
示例2: setLabel
def setLabel(self, partition, label):
label = self.availableLabel(label)
cmd_path = sysutils.find_executable("mkswap")
cmd = "%s -v1 -L %s %s" % (cmd_path, label, partition.getPath())
try:
p = os.popen(cmd)
p.close()
except:
return False
return True
示例3: format
def format(self, partition):
self.preFormat(partition)
cmd_path = sysutils.find_executable("mke2fs")
if not cmd_path:
cmd_path = sysutils.find_executable("mkfs.ext3")
if not cmd_path:
e = "Command not found to format %s filesystem" %(self.name())
raise FSError, e
# Use hashed b-trees to speed up lookups in large directories
cmd = "%s -O dir_index -j %s" %(cmd_path, partition.getPath())
p = os.popen(cmd)
o = p.readlines()
if p.close():
raise YaliException, "ext3 format failed: %s" % partition.getPath()
示例4: list_edd_signatures
def list_edd_signatures(self):
sigs = {}
if not os.path.exists(self.edd_dir):
cmd_path = sysutils.find_executable("modprobe")
cmd = "%s %s" %(cmd_path,"edd")
p = os.popen(cmd)
o = p.readlines()
if p.close():
raise YaliException, "Inserting EDD Module failed !"
for d in os.listdir(self.edd_dir):
bios_num = d[9:]
sigs[bios_num] = self.get_edd_sig(bios_num)
return sigs
示例5: tune2fs
def tune2fs(self, partition):
cmd_path = sysutils.find_executable("tune2fs")
if not cmd_path:
e = "Command not found to tune the filesystem"
raise FSError, e
# Disable mount count and use 6 month interval to fsck'ing disks at boot
cmd = "%s -c 0 -i 6m %s" % (cmd_path, partition.getPath())
p = os.popen(cmd)
o = p.readlines()
if p.close():
raise YaliException, "tune2fs tuning failed: %s" % partition.getPath()
示例6: minResizeMB
def minResizeMB(self, partition):
cmd_path = sysutils.find_executable("dumpe2fs")
if not cmd_path:
e = "Command not found to get information about %s" %(partition)
raise FSError, e
lines = os.popen("%s -h %s" % (cmd_path, partition.getPath())).readlines()
total_blocks = long(filter(lambda line: line.startswith('Block count'), lines)[0].split(':')[1].strip('\n').strip(' '))
free_blocks = long(filter(lambda line: line.startswith('Free blocks'), lines)[0].split(':')[1].strip('\n').strip(' '))
block_size = long(filter(lambda line: line.startswith('Block size'), lines)[0].split(':')[1].strip('\n').strip(' '))
return (((total_blocks - free_blocks) * block_size) / parteddata.MEGABYTE) + 150
示例7: format
def format(self, partition):
self.preFormat(partition)
cmd_path = sysutils.find_executable("mkreiserfs")
if not cmd_path:
e = "Command not found to format %s filesystem" %(self.name())
raise FSError, e
cmd = "%s %s" %(cmd_path, partition.getPath())
p = os.popen(cmd, "w")
p.write("y\n")
if p.close():
raise YaliException, "reiserfs format failed: %s" % partition.getPath()
示例8: resize
def resize(self, size_mb, partition):
if size_mb < self.minResizeMB(partition):
return False
cmd_path = sysutils.find_executable("resize2fs")
if not cmd_path:
e = "Command not found to format %s filesystem" %(self.name())
raise FSError, e
cmd = "%s %s %sM" % (cmd_path, partition.getPath(), str(size_mb))
try:
p = os.popen(cmd)
p.close()
except:
return False
return True
示例9: setOrderedDiskList
def setOrderedDiskList():
devices = detectAll()
devices.sort()
import yali.gui.context as ctx
# Check EDD Module
if not os.path.exists("/sys/firmware/edd"):
cmd_path = sysutils.find_executable("modprobe")
cmd = "%s %s" % (cmd_path, "edd")
res = sysutils.run(cmd)
if not res:
ctx.installData.orderedDiskList = devices
ctx.debugger.log("ERROR : Inserting EDD Module failed !")
return
edd = EDD()
sortedList = []
edd_list = edd.list_edd_signatures()
mbr_list = edd.list_mbr_signatures()
edd_keys = edd_list.keys()
edd_keys.sort()
for bios_num in edd_keys:
edd_sig = edd_list[bios_num]
if mbr_list.has_key(edd_sig):
sortedList.append(mbr_list[edd_sig])
if len(devices) > 1:
a = ctx.installData.orderedDiskList = sortedList
b = devices
# check consistency of diskList
if not len(filter(None, map(lambda x: x in a,b))) == len(b):
ctx.installData.orderedDiskList = devices
ctx.isEddFailed = True
else:
ctx.installData.orderedDiskList = devices
示例10: requires
def requires(command):
cmd_path = sysutils.find_executable(command)
if not cmd_path:
raise FSError, "Command not found: %s " % command
return cmd_path