summaryrefslogtreecommitdiff
path: root/portato.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xportato.py34
1 files changed, 6 insertions, 28 deletions
diff --git a/portato.py b/portato.py
index fd1d541..866dd49 100755
--- a/portato.py
+++ b/portato.py
@@ -5,7 +5,7 @@
# File: portato.py
# This file is part of the Portato-Project, a graphical portage-frontend.
#
-# Copyright (C) 2006-2007 René 'Necoro' Neumann
+# Copyright (C) 2006-2008 René 'Necoro' Neumann
# This is free software. You may redistribute copies of it under the terms of
# the GNU General Public License version 2.
# There is NO WARRANTY, to the extent permitted by law.
@@ -19,10 +19,7 @@ import gettext, locale
from optparse import OptionParser, SUPPRESS_HELP
from portato import get_listener
-from portato.constants import VERSION, FRONTENDS, STD_FRONTEND, XSD_LOCATION, LOCALE_DIR, APP, SU_COMMAND
-
-def get_frontend_list ():
- return ", ".join(["'%s'" % x for x in FRONTENDS])
+from portato.constants import VERSION, XSD_LOCATION, LOCALE_DIR, APP, SU_COMMAND
def main ():
# set gettext stuff
@@ -38,9 +35,6 @@ def main ():
parser = OptionParser(version = vers, prog = "Portato", description = desc, usage = usage)
- parser.add_option("-f", "--frontend", action = "store", choices = FRONTENDS, default = STD_FRONTEND, dest = "frontend",
- help = _("the frontend to use - possible values are: %s [default: %%default]") % get_frontend_list())
-
parser.add_option("--shm", action = "store", nargs = 3, type="long", dest = "shm",
help = SUPPRESS_HELP)
@@ -53,20 +47,6 @@ def main ():
# run parser
(options, args) = parser.parse_args()
- if len(args): # additional arguments overwrite given frontend
- arg = args[0]
- if arg not in FRONTENDS:
- print _("Unknown frontend '%(frontend)s'. Correct frontends are: %(list)s") % {"frontend": arg, "list": get_frontend_list()}
- sys.exit(2)
- else:
- options.frontend = arg
-
- try:
- exec ("from portato.gui.%s import run" % options.frontend)
- except ImportError, e:
- print _("'%(frontend)s' should be installed, but cannot be imported. This is definitely a bug. (%(error)s)") % {"frontend": options.frontend, "error": e[0]}
- sys.exit(1)
-
if options.validate: # validate a plugin
from lxml import etree
try:
@@ -80,8 +60,10 @@ def main ():
else:
print _("Validation succeeded.")
return
-
+
elif options.nofork or os.getuid() == 0: # start GUI
+ from portato.gui import run
+
if options.shm:
get_listener().set_send(*options.shm)
else:
@@ -100,15 +82,11 @@ def main ():
sig = shm.create_semaphore(InitialValue = 0, permissions = 0600)
rw = shm.create_semaphore(InitialValue = 1, permissions = 0600)
- additional = []
- if options.frontend:
- additional.extend(["--frontend", options.frontend])
-
# set DBUS_SESSION_BUS_ADDRESS to "" to make dbus work as root ;)
env = os.environ.copy()
env.update(DBUS_SESSION_BUS_ADDRESS="")
cmd = SU_COMMAND.split()
- subprocess.Popen(cmd+["%s --no-fork --shm %ld %ld %ld %s" % (sys.argv[0], mem.key, sig.key, rw.key, " ".join(additional))], env = env)
+ subprocess.Popen(cmd+["%s --no-fork --shm %ld %ld %ld" % (sys.argv[0], mem.key, sig.key, rw.key)], env = env)
get_listener().set_recv(mem, sig, rw)