本文整理汇总了Python中relinux.configutils.getValue函数的典型用法代码示例。如果您正苦于以下问题:Python getValue函数的具体用法?Python getValue怎么用?Python getValue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getValue函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: 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")
for i in config.AptCache:
if 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()
示例2: run
def run(self):
# Edit the casper.conf
# Strangely enough, casper uses the "quiet" flag if the build system is either Debian or Ubuntu
if config.VStatus is False:
logger.logI(self.tn, _("Editing casper and LSB configuration files"))
logger.logV(self.tn, _("Editing casper.conf"))
buildsys = "Ubuntu"
if configutils.parseBoolean(configutils.getValue(configs[configutils.casperquiet])) is False:
buildsys = ""
unionfs = configutils.getValue(configs[configutils.unionfs])
if unionfs == "overlayfs" and aptutil.compVersions(aptutil.getPkgVersion(aptutil.getPkg("casper", aptcache)), "1.272", aptutil.lt):
logger.logW(self.tn, _("Using DEFAULT instead of overlayfs"))
unionfs = "DEFAULT"
self.varEditor(tmpsys + "etc/casper.conf", {
"USERNAME": configutils.getValue(configs[configutils.username]),
"USERFULLNAME":
configutils.getValue(configs[configutils.userfullname]),
"HOST": configutils.getValue(configs[configutils.host]),
"BUILD_SYSTEM": buildsys,
"FLAVOUR": configutils.getValue(configs[configutils.flavour]),
"UNIONFS": unionfs})
logger.logV(self.tn, _("Editing lsb-release"))
self.varEditor(tmpsys + "etc/lsb-release", {
"DISTRIB_ID": configutils.getValue(configs[configutils.sysname]),
"DISTRIB_RELEASE": configutils.getValue(configs[configutils.version]),
"DISTRIB_CODENAME": configutils.getValue(configs[configutils.codename]),
"DISTRIB_DESCRIPTION":
configutils.getValue(configs[configutils.description])})
示例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):
# 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()
示例5: run
def run(self):
if configutils.parseBoolean(configutils.getValue(configs[configutils.enablewubi])) is True:
logger.logV(self.tn, _("Generating the windows autorun.inf"))
files = open(isotreel + "autorun.inf", "w")
files.write("[autorun]\n")
files.write("open=wubi.exe\n")
files.write("icon=wubi.exe,0\n")
files.write("label=Install " + configutils.getValue(configs[configutils.sysname]) + "\n")
files.write("\n")
files.write("[Content]\n")
files.write("MusicFiles=false\n")
files.write("PictureFiles=false\n")
files.write("VideoFiles=false\n")
files.close()
示例6: onWrite
def onWrite(msg):
if not configutils.getValue(config.Configuration["Relinux"]["EXPERIMENTFEATURES"]):
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")
)
示例7: 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)
示例8: 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_()
示例9: 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"))
pkglistu = config.AptCache.packages
writer = open(isotreel + "casper/filesystem.manifest", "w")
writer_desktop = open(isotreel + "casper/filesystem.manifest-desktop", "w")
for i in pkglistu:
if i.current_ver == None:
continue
name = i.get_fullname(True).strip()
ver = i.current_ver.ver_str.strip()
strs = name + " " + ver + "\n"
writer.write(strs)
if (not name in
configutils.parseMultipleValues(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()
示例10: 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 (True or
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("#!/bin/sh\n")
aptsetup.write("exit\n")
aptsetup.close()
示例11: run
def run(adict):
global configs, aptcache, page, isotreel, tmpsys
configs = adict["config"]["OSWeaver"]
isodir = configutils.getValue(configs[configutils.isodir])
isotreel = isodir + "/.ISO_STRUCTURE/"
tmpsys = isodir + "/.TMPSYS/"
aptcache = adict["aptcache"]
ourgui = adict["gui"]
pagenum = ourgui.wizard.add_tab()
page = gui.Frame(ourgui.wizard.page(pagenum))
ourgui.wizard.add_page_body(pagenum, _("OSWeaver"), page)
page.frame = gui.Frame(page, borderwidth=2, relief=Tkinter.GROOVE)
page.progress = gui.Progressbar(page)
page.progress.pack(fill=Tkinter.X, expand=True, side=Tkinter.BOTTOM,
anchor=Tkinter.S)
page.frame.pack(fill=Tkinter.BOTH, expand=True, anchor=Tkinter.CENTER)
page.button = gui.Button(page.frame, text="Start!", command=runThreads)
page.button.pack()
示例12: 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")
示例13: writeAll
def writeAll(status, lists, tn, importance, text, **options):
if tn == "" or tn is None or not status:
return
text_ = "[" + tn + "] "
if importance == E:
text_ += MError
elif importance == W:
text_ += MWarning
elif importance == D:
text_ += MDebug
from relinux import configutils
if not configutils.getValue(config.Configuration["Relinux"]["DEBUG"]):
return
else:
text_ += ""
text__ = text_ + text
text = text__
for i in lists:
if i in config.TermStreams and "noterm" in options and options["noterm"]:
continue
if i == config.GUIStream and "nogui" in options and options["nogui"]:
continue
text_ = copy.copy(text)
if i in config.TermStreams:
text__ = "\033["
if importance == E:
text__ += str(config.TermRed)
elif importance == W:
text__ += str(config.TermYellow)
elif importance == D:
text__ += str(config.TermGreen)
'''elif importance == I:
text__ += config.TermBlue'''
text__ += "m" + text_ + "\033[" + str(config.TermReset) + "m"
text_ = text__
i.write(utilities.utf8(text_ + MNewline))
示例14: getDiskName
def getDiskName():
return configutils.getValue(configs[configutils.label]) + " - Release " + config.Arch
示例15: 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)