本文整理汇总了Python中relinux.logger.logI函数的典型用法代码示例。如果您正苦于以下问题:Python logI函数的具体用法?Python logI怎么用?Python logI使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了logI函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
def run(self):
logger.logI(self.tn, _("Generating the tree for the temporary filesystem"))
fsutil.maketree([tmpsys + "etc", tmpsys + "dev",
tmpsys + "proc", tmpsys + "tmp",
tmpsys + "sys", tmpsys + "mnt",
tmpsys + "media/cdrom", tmpsys + "var", tmpsys + "home"], self.tn)
fsutil.chmod(tmpsys + "tmp", "1777", self.tn)
示例2: runthread
def runthread(self):
logger.logI(self.tn, logger.I, _("Generating ISO Tree"))
# Clean the tree, if it exists
fsutil.rm(isotreel)
# Make the tree
fsutil.maketree([isotreel + "casper", isotreel + "preseed",
isotreel + "isolinux", isotreel + ".disk"])
示例3: isCompatible
def isCompatible(module):
if module.relinuxmoduleapi != config.ModAPIVersion:
logger.logI(tn, logger.W, _("Module") + " " + module.modulename + " " +
_("is incompatible with this relinux version") + " (" + _("relinux version:") + " " +
config.version + ", " + _("required version:") + " " + module.relinuxmoduleapi + ")")
return False
return True
示例4: showMessage
def showMessage(tn, importance, msg):
logger.logI(tn, importance, msg)
QtCore.QMetaObject.invokeMethod(
ui.msgbox, "setImportance", QtCore.Qt.QueuedConnection, QtCore.Q_ARG("QString", importance)
)
QtCore.QMetaObject.invokeMethod(
ui.msgbox, "realSetText", QtCore.Qt.QueuedConnection, QtCore.Q_ARG("QString", msg)
)
QtCore.QMetaObject.invokeMethod(ui.msgbox, "exec", QtCore.Qt.QueuedConnection)
示例5: runthread
def runthread(self):
logger.logI(self.tn, logger.I, _("Copying files to the temporary filesystem"))
excludes = configutils.parseMultipleValues(configutils.getValue(configs[configutils.excludes]))
varexcludes = excludes
# Exclude all log files (*.log *.log.*), PID files (to show that no daemons are running),
# backup and old files (for obvious reasons), and any .deb files that a person might have downloaded
varexcludes.extend(["*.log", "*.log.*", "*.pid", "*/pid", "*.bak", "*.[0-9].gz", "*.deb"])
fsutil.fscopy("/etc", tmpsys + "etc", excludes, self.tn)
fsutil.fscopy("/var", tmpsys + "var", varexcludes, self.tn)
示例6: doSFSChecks
def doSFSChecks(files, isolvl):
logger.logI(tn, logger.I, _("Checking the compressed filesystem"))
size = fsutil.getSize(files)
lvl2 = fsutil.sizeTrans({"G": 4})
lvl3 = fsutil.sizeTrans({"T": 8})
if size > lvl2 and isolvl < 3:
dispiso9660(isolvl, lvl2, size)
elif size > lvl3 and isolvl >= 3:
# 8TB OS? That's a bit much xD
dispiso9660(isolvl, lvl3, size)
示例7: runthread
def runthread(self):
logger.logI(self.tn, logger.I, _(
"Generating the tree for the temporary filesystem"))
# Clean the TMPSYS tree, if it exists
fsutil.rm(tmpsys)
self.progressfunc(20)
# Generate the tree
fsutil.maketree([tmpsys + "etc", tmpsys + "dev",
tmpsys + "proc", [tmpsys + "tmp", 0o1777],
tmpsys + "sys", tmpsys + "mnt",
tmpsys +
"media/cdrom", tmpsys + "var", tmpsys + "home",
tmpsys + "run"], self.tn, lambda p: self.progressfunc(20 + p / (5 / 3)))
fsutil.chmod(tmpsys + "tmp", 0o1777, self.tn)
示例8: 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()
示例9: run
def run(self):
logger.logI(self.tn, _("Making the ISO compatible with a USB burner"))
logger.logVV(self.tn, _("Writing .disk/info"))
files = open(isotreel + ".disk/info", "w")
files.write(getDiskName())
files.close()
logger.logV(self.tn, _("Making symlink pointing to the ISO root dir"))
os.symlink(isotreel + "ubuntu", isotreel)
logger.logVV(self.tn, _("Writing release notes URL"))
files = open(isotreel + ".disk/release_notes_url", "w")
files.write(configutils.getValue(configs[configutils.url]) + "\n")
files.close()
logger.logVV(self.tn, _("Writing .disk/base_installable"))
fsutil.touch(isotreel + ".disk/base_installable")
logger.logVV(self.tn, _("Writing CD Type"))
files = open(isotreel + ".disk/cd_type", "w")
files.write("full_cd/single\n")
files.close()
示例10: getModules
def getModules():
returnme = []
modules = os.listdir(config.ModFolder)
for i in modules:
dirs = os.path.join(config.ModFolder, i)
if not os.path.isdir(dirs) or not "__init__.py" in os.listdir(dirs):
continue
file, pathname, desc = imp.find_module("__init__", [dirs])
module = imp.load_module("__init__", file, pathname, desc)
if not isModule(module):
continue
loadme = True
if not isCompatible(module):
loadme = False
if loadme:
returnme.append({"name": i, "file": file, "path": pathname, "desc": desc})
else:
logger.logI(tn, logger.W, _("Module") + " " + module.modulename + " " + _("will not be loaded"))
return returnme
示例11: 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()
示例12: runthread
def runthread(self):
self.event = threading.Event()
self.ap = aptutil.AcquireProgress(lambda p: self.percentfunc(p / 2))
self.ip = aptutil.InstallProgress(
lambda p: self.percentfunc(50 + p / 2),
lambda: self.finishfunc(self.event))
logger.logI(self.tn, logger.I, _("Setting up distro dependencies"))
logger.logV(self.tn, logger.I, _("Setting up Ubiquity"))
if configutils.getValue(configs[configutils.instfront]).lower() == "kde":
self.instPkg("ubiquity-frontend-kde", True)
self.remPkg("ubiquity-frontend-gtk")
else:
self.instPkg("ubiquity-frontend-gtk", True)
self.remPkg("ubiquity-frontend-kde")
logger.logV(self.tn, logger.I, _("Setting up Popularity Contest"))
if configutils.getValue(configs[configutils.popcon]):
self.instPkg("popularity-contest")
else:
self.remPkg("popularity-contest")
if configutils.getValue(configs[configutils.memtest]):
logger.logV(self.tn, logger.I, _("Setting up memtest86+"))
self.instPkg("memtest86+")
logger.logV(
self.tn, logger.I, _("Setting up other distro dependencies"))
self.instPkg("ubuntu-minimal")
self.instPkg("syslinux", True)
self.instPkg("discover")
self.instPkg("coreutils")
self.instPkg("bash")
self.instPkg("initramfs-tools")
self.instPkg("casper")
self.instPkg("laptop-detect")
logger.logI(self.tn, logger.I, _(
"Setting up relinux generation dependencies"))
self.instPkg("squashfs-tools", True)
self.instPkg("genisoimage", True)
configutils.saveBuffer(config.Configuration)
aptutil.commitChanges(self.aptcache, self.ap, self.ip)
self.exec_()
示例13: runthread
def runthread(self):
# If the user-setup-apply file does not exist, and there is an alternative, we'll copy it over
logger.logI(self.tn, logger.I, _("Setting up the installer"))
if (os.path.isfile("/usr/lib/ubiquity/user-setup/user-setup-apply.orig") and not
os.path.isfile("/usr/lib/ubiquity/user-setup/user-setup-apply")):
shutil.copy2("/usr/lib/ubiquity/user-setup/user-setup-apply.orig",
"/usr/lib/ubiquity/user-setup/user-setup-apply")
# If the user requested to make sure that the installer does _not_ change the apt sources,
# make sure that relinux obeys this.
# However, if the user changed his/her mind, we want to make sure that relinux
# work with that too
if not configutils.getValue(configs[configutils.aptlistchange]):
if not os.path.exists("/usr/share/ubiquity/apt-setup.relinux-backup"):
os.rename("/usr/share/ubiquity/apt-setup",
"/usr/share/ubiquity/apt-setup.relinux-backup")
aptsetup = open("/usr/share/ubiquity/apt-setup", "w")
aptsetup.write("\n")
aptsetup.close()
fsutil.chmod("/usr/share/ubiquity/apt-setup", 0o755, self.tn)
elif os.path.exists("/usr/share/ubiquity/apt-setup.relinux-backup"):
# TODO: Fix the 40cdrom bug?
fsutil.rm("/usr/share/ubiquity/apt-setup", False, self.tn)
os.rename("/usr/share/ubiquity/apt-setup.relinux-backup",
"/usr/share/ubiquity/apt-setup")
示例14: main
#.........这里部分代码省略.........
cbuffer = configutils.parseFiles(configfiles)
config.Configuration = cbuffer
configutils.saveBuffer(config.Configuration)
\'''for i in configutils.beautify(buffer1):
print(i)\'''
spprog += 1
splash.setProgress(
calcPercent((spprog, spprogn)), "Reading APT Cache...")
def aptupdate(op, percent):
global minis
if percent != None:
minis += utilities.floatDivision(percent, 100)
splash.setProgress(
calcPercent((utilities.floatDivision(
minis + captop, aptops) + spprog, spprogn)),
"Reading APT Cache... (" + op + ")")
def aptdone(op):
global minis, captop
minis = 0.0
captop += 1
aptcache = aptutil.getCache(aptutil.OpProgress(aptupdate, aptdone))
config.AptCache = aptcache
spprog += 1
splash.setProgress(
calcPercent((spprog, spprogn)), "Loading the GUI...")
App = gui.GUI(root)
spprog += 1
splash.setProgress(
calcPercent((spprog, spprogn)), "Filling in configuration...")
App.fillConfiguration(cbuffer)
spprog += 1
splash.setProgress(
calcPercent((spprog, spprogn)), "Running modules...")
for i in modules:
modloader.runModule(i,
{"gui": App, "config": cbuffer, "aptcache": aptcache})
spprog += 1
splash.setProgress(calcPercent((spprog, spprogn)), "Launching relinux")
splash = gui.Splash(root, startProg)
#root.overrideredirect(Tkinter.TRUE) # Coming soon!
root.mainloop()'''
App = QtGui.QApplication(sys.argv)
splash = QtGui.QSplashScreen(
QtGui.QPixmap(relinuxdir + "/splash_light.png"))
splash.show()
App.processEvents()
def showMessage(str_):
splash.showMessage(
str_ + "...", QtCore.Qt.AlignLeft | QtCore.Qt.AlignBottom)
App.processEvents()
showMessage(_("Loading modules"))
modules = []
modulemetas = modloader.getModules()
for i in modulemetas:
modules.append(modloader.loadModule(i))
showMessage(_("Loading configuration files"))
configfiles = [relinuxdir + "/relinux.conf"]
for i in range(len(modulemetas)):
for x in modules[i].moduleconfig:
if "RELINUXCONFDIR" in os.environ:
configfiles.append(os.path.join(relinuxdir, x))
else:
configfiles.append(
os.path.join(os.path.dirname(modulemetas[i]["path"]), x))
cbuffer = configutils.parseFiles(configfiles)
config.Configuration = cbuffer
configutils.saveBuffer(config.Configuration)
logfilename = configutils.getValue(cbuffer["Relinux"]["LOGFILE"])
logfile = open(logfilename, "a")
config.EFiles.append(logfile)
config.IFiles.append(logfile)
config.VFiles.append(logfile)
config.VVFiles.append(logfile)
logger.logI(tn, logger.I, "===========================")
logger.logI(tn, logger.I, "=== Started new session ===")
logger.logI(tn, logger.I, "===========================")
showMessage(_("Loading APT cache 0%"))
def aptupdate(op, percent):
global minis
if percent:
minis = int(percent)
showMessage(
_("Loading APT cache") + " (" + op + ") " + str(minis) + "%")
aptcache = aptutil.getCache(aptutil.OpProgress(aptupdate, None))
config.AptCache = aptcache
if not args.nostylesheet:
showMessage(_("Loading stylesheet"))
App.setStyleSheet(open(mainsrcdir + "/stylesheet.css", "r").read())
showMessage(_("Loading GUI"))
gui_ = gui.GUI(App)
config.Gui = gui_
showMessage(_("Running modules"))
for i in modules:
modloader.runModule(i, {})
gui_.show()
splash.finish(gui_)
exitcode = App.exec_()
config.ThreadStop = True
logfile.close()
sys.exit(exitcode)
示例15: page
def page(self, page_num):
if page_num < len(self.pages):
return self.pages[page_num]
else:
logger.logI(tn, logger.E, _("Page") + " " + str(page_num) + " " + _("does not exist"))