本文整理汇总了Python中relinux.logger.logVV函数的典型用法代码示例。如果您正苦于以下问题:Python logVV函数的具体用法?Python logVV怎么用?Python logVV使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了logVV函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onWrite
def onWrite(msg):
logger.logVV(tn, logger.D, "Updating terminal (from thread " + threading.current_thread().name + ")")
#return
ui.terminal.moveCursor(QtGui.QTextCursor.End, QtGui.QTextCursor.MoveAnchor)
QtCore.QMetaObject.invokeMethod(ui.terminal, "insertPlainText",
QtCore.Qt.QueuedConnection,
QtCore.Q_ARG("QString", msg.rstrip() + "\n"))
示例2: runthread
def runthread(self):
logger.logV(self.tn, logger.I, _("Copying ISOLINUX to the ISO tree"))
copyFile("/usr/lib/syslinux/isolinux.bin", isotreel +
"isolinux/", self.tn, True)
self.setProgress(self.tn, 20)
copyFile("/usr/lib/syslinux/vesamenu.c32", isotreel +
"isolinux/", self.tn, True)
self.setProgress(self.tn, 40)
logger.logVV(
self.tn, logger.I, _("Copying isolinux.cfg to the ISO tree"))
copyFile(configutils.getValue(configs[configutils.isolinuxfile]), isotreel +
"isolinux/isolinux.cfg", self.tn, True)
self.setProgress(self.tn, 50)
# Edit the isolinux.cfg file to replace the variables
logger.logV(self.tn, logger.I, _("Editing isolinux.cfg"))
splash = os.path.basename(
configutils.getValue(configs[configutils.splash]))
shutil.copy2(configutils.getValue(configs[configutils.splash]),
isotreel + "isolinux/" + splash)
self.setProgress(self.tn, 70)
for i in [["LABEL", configutils.getValue(configs[configutils.label])],
["SPLASH", splash],
["TIMEOUT", configutils.getValue(configs[configutils.timeout])]]:
fsutil.ife(
fsutil.ife_getbuffers(isotreel + "isolinux/isolinux.cfg"),
lambda line: [True, re.sub("\$" + i[0], i[1], line)])
示例3: run
def run(self):
logger.logI(tn, _("Generating compressed filesystem"))
# Generate the SquashFS file
# Options:
# -b 1M Use a 1M blocksize (maximum)
# -no-recovery No recovery files
# -always-use-fragments Fragment blocks for files larger than the blocksize (1M)
# -comp Compression type
logger.logVV(tn, _("Generating options"))
opts = "-b 1M -no-recovery -no-duplicates -always-use-fragments"
opts = opts + " -comp " + configutils.getValue(configs[configutils.sfscomp])
opts = opts + " " + configutils.getValue(configs[configutils.sfsopts])
sfsex = "dev etc home media mnt proc sys var usr/lib/ubiquity/apt-setup/generators/40cdrom"
sfspath = isotreel + "casper/filesystem.squashfs"
logger.logI(tn, _("Adding the edited /etc and /var to the filesystem"))
os.system("mksquashfs " + tmpsys + " " + sfspath + " " + opts)
logger.logI(tn, _("Adding the rest of the system"))
os.system("mksquashfs / " + sfspath + " " + opts + " -e " + sfsex)
# Make sure the SquashFS file is OK
doSFSChecks(sfspath, int(configutils.getValue(configs[configutils.isolevel])))
# Find the size after it is uncompressed
logger.logV(tn, _("Writing the size"))
files = open(isotreel + "casper/filesystem.size", "w")
files.write(fsutil.getSFSInstSize(sfspath) + "\n")
files.close()
示例4: runthread
def runthread(self):
# Create the logs
logger.logV(self.tn, logger.I, _("Creating empty logs"))
for i in [
"dpkg.log",
"lastlog",
"mail.log",
"syslog",
"auth.log",
"daemon.log",
"faillog",
"lpr.log",
"mail.warn",
"user.log",
"boot",
"debug",
"mail.err",
"messages",
"wtmp",
"bootstrap.log",
"dmesg",
"kern.log",
"mail.info",
]:
logger.logVV(self.tn, logger.I, logger.MTab + _("Creating") + " " + i)
fsutil.touch(tmpsys + "var/log/" + i)
示例5: runthread
def runthread(self):
# Generate the package manifest
logger.logV(self.tn, logger.I, _("Generating package manifests"))
logger.logVV(self.tn, logger.I, _(
"Generating filesystem.manifest and filesystem.manifest-desktop"))
writer = open(isotreel + "casper/filesystem.manifest", "w")
writer_desktop = open(
isotreel + "casper/filesystem.manifest-desktop", "w")
# installedVersion throws an error when it doesn't exist in 'Package'
# TODO: figure out why, but for now.. check for attribute as well
for i in config.AptCache:
if not hasattr(i,'installedVersion') or i.installedVersion is None or len(i.installedVersion) <= 0:
continue
name = i.fullname.strip()
ver = i.installedVersion.strip()
strs = name + " " + ver + "\n"
writer.write(strs)
if (not name in
configutils.getValue(configs[configutils.remafterinst])):
writer_desktop.write(strs)
writer.close()
writer_desktop.close()
logger.logVV(
self.tn, logger.I, _("Generating filesytem.manifest-remove"))
writer = open(isotreel + "casper/filesystem.manifest-remove", "w")
for i in configutils.parseMultipleValues(configutils.getValue(configs[configutils.remafterinst])):
writer.write(i.strip() + "\n")
writer.close()
示例6: touch
def touch(files, tn=""):
if os.path.exists(files):
logger.logVV(tn, logger.I, _("Touching file") + " " + str(files))
os.utime(files, None)
else:
logger.logVV(tn, logger.I, _("Creating file") + " " + str(files))
open(files, "w").close()
示例7: addOptional
def addOptional(threads):
for i in range(len(threads)):
if not "threadspan" in threads[i]:
threads[i]["threadspan"] = 1
if not "enabled" in threads[i]:
threads[i]["enabled"] = True
logger.logVV(tn, logger.D, "Check addoptional")
示例8: makedir
def makedir(dirs1, tn=""):
dirs = dirs1
mode = 0o777
if isinstance(dirs1, list):
dirs = dirs1[0]
mode = dirs1[1]
if not os.path.exists(dirs):
logger.logVV(tn, logger.I, _("Creating directory") + " " + str(dirs))
os.makedirs(dirs, mode)
示例9: runthread
def runthread(self):
# Create the logs
logger.logV(self.tn, logger.I, _("Creating empty logs"))
a = ["dpkg.log", "lastlog", "mail.log", "syslog", "auth.log", "daemon.log", "faillog",
"lpr.log", "mail.warn", "user.log", "boot", "debug", "mail.err", "messages", "wtmp",
"bootstrap.log", "dmesg", "kern.log", "mail.info"]
la = len(a)
inc = 100 / la
for i in range(la):
logger.logVV(
self.tn, logger.I, logger.MTab + _("Creating") + " " + a[i])
fsutil.touch(tmpsys + "var/log/" + a[i])
self.setProgress(self.tn, (i + 1) * inc)
示例10: fscopy
def fscopy(src, dst, excludes1, tn=""):
# Get a list of all files
files = listdir(src, {"recurse": True, "dirs": True, "symlinks": True}, tn)
# Exclude the files that are not wanted
excludes = []
if len(excludes1) > 0:
excludes = exclude(files, excludes1)
makedir(dst)
# Copy the files
for file in files:
# Make sure we don't copy files that are supposed to be excluded
if file in excludes:
logger.logVV(tn, file + " " + _("is to be excluded. Skipping a CPU cycle"))
continue
fullpath = os.path.join(src, file)
newpath = os.path.join(dst, file)
dfile = delink(fullpath)
if dfile is not None:
logger.logVV(tn, file + " " + _("is a symlink. Creating an identical symlink at") + " " +
newpath)
os.symlink(dfile, newpath)
elif os.path.isdir(fullpath):
logger.logVV(tn, _("Recursing into") + " " + file)
fscopy(fullpath, newpath, excludes, tn)
else:
logger.logVV(tn, _("Copying") + " " + fullpath + " " + _("to") + " " + newpath)
shutil.copy2(fullpath, newpath)
logger.logV(tn, _("Setting permissions"))
shutil.copystat(src, dst)
示例11: run
def run(self):
logger.logV(self.tn, _("Copying ISOLINUX to the ISO tree"))
copyFile("/usr/lib/syslinux/isolinux.bin", isotreel + "isolinux/", True)
copyFile("/usr/lib/syslinux/vesamenu.c32", isotreel + "isolinux/", True)
logger.logVV(self.tn, _("Copying isolinux.cfg to the ISO tree"))
copyFile(configutils.getValue(configs[configutils.isolinuxfile], isotreel +
"isolinux/isolinux.cfg", True))
# Edit the isolinux.cfg file to replace the variables
logger.logV(_("Editing isolinux.cfg"))
for i in [["LABEL", configutils.getValue(configs[configutils.label])],
["SPLASH", configutils.getValue(configs[configutils.splash])],
["TIMEOUT", configutils.getValue(configs[configutils.timeout])]]:
fsutil.ife(fsutil.ife_getbuffers(isotreel + "isolinux/isolinux.cfg"),
lambda line: re.sub("\$" + i[0], i[1], line))
示例12: runthread
def runthread(self):
logger.logI(self.tn, logger.I, _("Starting generation of the ISO image"))
# Make a last verification on the SquashFS
squashfs.doSFSChecks(isotreel + "casper/filesystem.squashfs",
configutils.getValue(configs[configutils.isolevel]))
self.setProgress(self.tn, 5)
# Generate MD5 checksums
logger.logV(self.tn, logger.I, _("Generating MD5 sums"))
files = open(isotreel + "md5sum.txt", "w")
for x in fsutil.listdir(isotreel, {"recurse": True}):
i = re.sub(r"^ *" + isotreel + "/*", "./", x)
if not "isolinux" in i and not "md5sum" in i:
logger.logVV(self.tn, logger.I, _("Writing MD5 sum of") + " " + i)
fmd5 = fsutil.genFinalMD5(i, x)
if fmd5 != "" and fmd5 != None:
files.write(fmd5)
files.close()
self.setProgress(self.tn, 15)
logger.logI(self.tn, logger.I, _("Generating the ISO"))
location = (configutils.getValue(configs[configutils.isodir]) + "/" +
configutils.getValue(configs[configutils.isolocation]))
patt = re.compile("^ *([0-9]+)\.?[0-9]*%.*$")
appnd = "32"
if sys.maxsize > 2 ** 32:
appnd = "64"
os.environ["LD_PRELOAD"] = os.path.split(os.path.realpath(__file__))[0] + "/isatty" + appnd + ".so"
isocmd = subprocess.Popen(shlex.split(configutils.getValue(configs[configutils.isogenerator]) + " -o " +
location + " " + isogenopts + " -V \"" +
configutils.getValue(configs[configutils.label]) + "\" " + isotreel),
stderr=subprocess.PIPE, universal_newlines=True)
oldprogress = 0
while isocmd.poll() is None:
output = isocmd.stderr.readline()
match = patt.match(output)
if match != None:
progress = int(match.group(1))
if progress > oldprogress:
# 1.4285714285714286 is just 100 / 70
self.setProgress(self.tn, 15 + int(utilities.floatDivision(progress, 1.4285714285714286)))
oldprogress = progress
sys.stdout.write(output)
sys.stdout.flush()
os.environ["LD_PRELOAD"] = ""
self.setProgress(self.tn, 85)
# Generate the MD5 sum
logger.logV(self.tn, logger.I, _("Generating MD5 sum for the ISO"))
files = open(location + ".md5", "w")
files.write(fsutil.genFinalMD5("./" + configutils.getValue(configs[configutils.isolocation]),
location))
files.close()
示例13: adrm
def adrm(dirs, options, excludes1 = [], tn = ""):
# Get a list of all files inside the directory
files = listdir(dirs, {"recurse": True, "dirs": True, "symlinks": False}, tn)
excludes = []
# Exclude the files listed to exclude
if options["excludes"] and len(excludes1) > 0:
excludes = exclude(files, excludes1)
# Remove the wanted files
for file_ in files:
file__ = utilities.utf8(file_)
file_ = utilities.utf8(os.path.basename(file__))
# Make sure we don't remove files that are listed to exclude from removal
if file__ in excludes:
logger.logVV(tn, logger.I, utilities.utf8all(file_, " ",
_("is to be excluded. Skipping a CPU cycle")))
continue
fullpath = file__
dfile = delink(fullpath)
if dfile == None:
if os.path.isfile(fullpath):
rm(fullpath)
elif os.path.isdir(fullpath) and options["remdirs"]:
rm(fullpath)
else:
if options["remsymlink"]:
logger.logVV(tn, logger.I, utilities.utf8all(_("Removing symlink"), " ", fullpath))
rm(fullpath)
if options["remfullpath"]:
logger.logVV(tn, logger.I, utilities.utf8all(_("Removing"), " ", dfile, " (",
_("directed by symlink"), fullpath, ")"))
rm(dfile)
if options["remdirs"] is True:
logger.logVV(tn, logger.I, utilities.utf8all(_("Removing source directory"), " ", dirs))
rm(dirs)
示例14: adrm
def adrm(dirs, options, excludes1=[], tn=""):
# Get a list of all files inside the directory
files = listdir(dirs, {"recurse": True, "dirs": True, "symlinks": True}, tn)
excludes = []
# Exclude the files listed to exclude
if options.excludes is True and len(excludes1) > 0:
excludes = exclude(files, excludes1)
# Remove the wanted files
for file in files:
# Make sure we don't remove files that are listed to exclude from removal
if file in excludes:
logger.logVV(tn, file + " " + _("is to be excluded. Skipping a CPU cycle"))
continue
fullpath = os.path.join(dirs, file)
dfile = delink(fullpath)
if dfile is not None:
if os.path.isfile(dfile):
rm(fullpath)
continue
elif os.path.isdir(fullpath):
adrm(fullpath, options, excludes1, tn)
else:
if options.remsymlink is True:
logger.logVV(tn, _("Removing symlink") + " " + fullpath)
rm(fullpath)
if options.remfullpath is True:
logger.logVV(tn, _("Removing") + " " + dfile + " (" + _("directed by symlink")
+ fullpath + ")")
if options.remdirs is True:
logger.logVV(tn, _("Removing source directory") + " " + dirs)
rm(dirs)
示例15: rm
def rm(files, followlink=False, tn=""):
if not os.path.exists(files):
# If there isn't anything to remove, why bother with this function?
return
rfile = files
dfile = delink(files)
rmstring = "Removing "
if os.path.isdir(files):
rmstring += "directory "
if dfile is not None:
files = dfile
if os.path.isfile(files):
logger.logVV(tn, logger.I, utilities.utf8all(_("Removing symlink"), " ", rfile))
elif os.path.isdir(files):
logger.logVV(tn, logger.I, utilities.utf8all(_("Removing directory symlink"), " ", rfile))
os.remove(rfile)
if followlink:
files = rfile
else:
return
if os.path.isfile(files):
logger.logVV(tn, logger.I, utilities.utf8all(_(rmstring), files))
os.remove(rfile)
elif os.path.isdir(files):
logger.logVV(tn, logger.I, utilities.utf8all(_(rmstring), files))
shutil.rmtree(rfile)