def main(argv): """ Start things up. """ config_obj = config_data.Config() config = config_obj.get() databases = config['databases'] url = databases['primary'] # connect db.Database(url) textdomain(I18N_DOMAIN) taskatron = Taskatron() if len(sys.argv) > 2 and sys.argv[1].lower() == "--test": print taskatron.node_comm(sys.argv[2],"test_add",1,2) elif len(sys.argv) > 1 and sys.argv[1].lower() == "--daemon": taskatron.clean_up_tasks() utils.daemonize("/var/run/vf_taskatron.pid") taskatron.run_forever() elif len(sys.argv) > 1 and sys.argv[1].lower() == "--infinity": taskatron.clean_up_tasks() taskatron.run_forever() elif len(sys.argv) == 1: print _("Running single task in debug mode, since --daemon wasn't specified...") taskatron.clean_up_tasks() taskatron.dotick(socket.gethostname(), True) else: useage = _("""Usage: vf_taskatron --test server.fqdn vf_taskatron --daemon vf_tasktron (no args) (just runs through one pass) """) print useage
def sanitizeString(s, translate=True): if len(s) == 0: return s if not translate: i18ndomains = [] elif hasattr(rpm, "expandMacro"): i18ndomains = rpm.expandMacro("%_i18ndomains").split(":") else: i18ndomains = ["redhat-dist"] # iterate over i18ndomains add to textdomain(), then translate for d in i18ndomains: if d not in _added_gettext_domains: try: # This horrible hack works around the python split() in gettext # problem. Example file is with a problem is: # /usr/share/locale/de/LC_MESSAGES/redhat-dist.mo textdomain(d) except AttributeError: pass _added_gettext_domains[d] = True s = _(s) s = s.replace("\n\n", "\x00") s = s.replace("\n", " ") s = s.replace("\x00", "\n\n") s = s.replace("&", "&") s = s.replace("<", "<") s = s.replace(">", ">") s = utf8(s) return s
# (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # from rhpl.translate import _, N_ import rhpl.translate as translate translate.textdomain('rhpl') def gkn(str): idx = str.find("|") if idx == -1: return str return str[idx + 1:] class KeyboardModels: def get_models(self): return self.modelDict def __init__(self): # NOTE: to add a keyboard model to this dict, copy the comment # above all of them, and then the key should be the console layout
import os import string import time import signal import snack import rocks.sql import rocks.commands import rocks.ip import rocks.util import rocks.app from syslog import syslog try: from rhpl.translate import _, N_ import rhpl.translate as translate translate.textdomain('insert-ethers') except: from gettext import gettext as _ class InsertError(Exception): pass class InsertDone(Exception): pass class DumpError(Exception): pass
import os import string import time import signal import snack import rocks.sql import rocks.commands import rocks.ip import rocks.util import rocks.app from syslog import syslog try: from rhpl.translate import _, N_ import rhpl.translate as translate translate.textdomain ('insert-ethers') except: from gettext import gettext as _ class InsertError(Exception): pass class InsertDone(Exception): pass class DumpError(Exception): pass class ServiceController:
os.environ["GNOME_DISABLE_CRASH_DIALOG"] = "1" import sys import gtk import functions import firstbootBackend from firstboot import Firstboot from rhpl.translate import cat from rhpl import ethtool ## ## I18N ## from rhpl.translate import _, N_ import rhpl.translate as translate translate.textdomain("firstboot") # # Stuff for screenshots # screenshotDir = None screenshotIndex = 0 class firstbootWindow: def __init__(self, fb): self.needsReboot = [] self.xserver_pid = fb.xserver_pid self.wm_pid = fb.wm_pid self.doReconfig = fb.doReconfig self.doDebug = fb.doDebug
# # You should have received a copy of the GNU Library Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # import kudzu import string import os from rhpl.executil import execWithCapture from rhpl.translate import _ import rhpl.translate as translate import rhpl translate.textdomain('rhpxl') class VideoCard: # # This class represents the base data about a videocard. These are # the internal members - PLEASE use methods to access values! # # device - if framebuffer running on card this is entry in /dev (string) # descr - human readable description (string) # driver - X driver # vidRam - amount of video ram (in kB) (string) # pcibus - PCI bus number of the card # pcidev - PCI device number of the card # pcifn - PCI fn number of the card #
# package_gui.py: package group selection screen # # Jeremy Katz <*****@*****.**> # # Copyright 2005 Red Hat, Inc. # # This software may be freely redistributed under the terms of the GNU # general public license. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # # FIXME: group selection isn't currently backend independent from pirut.GroupSelector import GroupSelector import gui from iw_gui import * from rhpl.translate import _, N_, textdomain textdomain("pirut") class GroupSelectionWindow (InstallWindow): def getScreen(self, anaconda): self.backend = anaconda.backend self.intf = anaconda.intf self.grpsel = GroupSelector(self.backend.ayum, gui.findGladeFile, gui.addFrame) self.grpsel.doRefresh() return self.grpsel.vbox
# create watch file wf = open("/var/lib/virt-factory-nodes/watch","w+") wf.write("") wf.close() websvc = XmlRpcInterface() host = socket.gethostname() if "--daemon" in sys.argv: utils.daemonize("/var/run/vf_node_server.pid") pid = os.fork() if pid == 0: serve_qpid("/etc/virt-factory-nodes/qpid.conf") else: try: serve_status() except KeyboardInterrupt: print "caught interrupt" os.kill(pid, signal.SIGINT) os.waitpid(pid,0) if __name__ == "__main__": _("test") # make gettext be quiet when there are no strings textdomain(I18N_DOMAIN) main(sys.argv)
import zonetab import pango import sys from timezone_map_gui import TimezoneMap from rhpl.translate import _, textdomain from iw_gui import * from bootloaderInfo import dosFilesystems from bootloader import hasWindows try: import gnomecanvas except ImportError: import gnome.canvas as gnomecanvas textdomain("system-config-date") class TimezoneWindow(InstallWindow): def __init__(self, ics): InstallWindow.__init__(self, ics) # Need to set the custom handler before loading the glade file or # this won't work. gtk.glade.set_custom_handler(self.custom_widget_handler) # Set the default now. We'll fix it for real in getScreen. self.default = "America/New_York" self.zonetab = zonetab.ZoneTab()
# library public license. # # You should have received a copy of the GNU Library Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # import string import iutil import os from time import * from snack import * from constants_text import * from rhpl.translate import _, textdomain textdomain("system-config-date") class TimezoneWindow: def getTimezoneList(self): if os.access("/usr/lib/timezones.gz", os.R_OK): cmd = "/usr/bin/gunzip" stdin = os.open("/usr/lib/timezones.gz", 0) else: zoneList = iutil.findtz('/usr/share/zoneinfo', '') cmd = "" stdin = None if cmd != "": zones = iutil.execWithCapture(cmd, [cmd], stdin=stdin) zoneList = string.split(zones)
# # Jeremy Katz <*****@*****.**> # # Copyright 2005 Red Hat, Inc. # # This software may be freely redistributed under the terms of the GNU # general public license. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # # FIXME: group selection isn't currently backend independent from pirut.GroupSelector import GroupSelector import gui from iw_gui import * from rhpl.translate import _, N_, textdomain textdomain("pirut") class GroupSelectionWindow(InstallWindow): def getScreen(self, anaconda): self.backend = anaconda.backend self.intf = anaconda.intf self.grpsel = GroupSelector(self.backend.ayum, gui.findGladeFile, gui.addFrame) self.grpsel.doRefresh() return self.grpsel.vbox