summaryrefslogtreecommitdiff
path: root/portato
diff options
context:
space:
mode:
authorNecoro <>2007-10-22 22:27:29 +0000
committerNecoro <>2007-10-22 22:27:29 +0000
commit7afdc03507e0aa95f177f8a7c95086de5cfcc06c (patch)
tree41b8b7c894b3e6979c67d5b4363993cbaa2f1a7b /portato
parent6d862d7a961ce70bc24450aadc99a901e5ab19c8 (diff)
downloadportato-7afdc03507e0aa95f177f8a7c95086de5cfcc06c.tar.gz
portato-7afdc03507e0aa95f177f8a7c95086de5cfcc06c.tar.bz2
portato-7afdc03507e0aa95f177f8a7c95086de5cfcc06c.zip
bundled shm module
Diffstat (limited to '')
-rwxr-xr-xportato.py8
-rw-r--r--portato/__init__.py11
-rw-r--r--portato/gui/gtk/__init__.py4
-rw-r--r--portato/gui/gtk/windows.py6
-rw-r--r--portato/plugins/notify.py4
5 files changed, 20 insertions, 13 deletions
diff --git a/portato.py b/portato.py
index 4019504..7cca894 100755
--- a/portato.py
+++ b/portato.py
@@ -23,7 +23,7 @@ try:
except ImportError:
from portato.shm import shm_wrapper as shm
-from portato import listener
+from portato import get_listener
from portato.constants import VERSION, FRONTENDS, STD_FRONTEND, XSD_LOCATION, LOCALE_DIR, APP, SU_COMMAND
def get_frontend_list ():
@@ -101,9 +101,9 @@ def main ():
elif options.nolistener or os.getuid() == 0: # start GUI
if options.shm:
- listener.set_send(*options.shm)
+ get_listener().set_send(*options.shm)
else:
- listener.set_send()
+ get_listener().set_send()
run()
@@ -125,7 +125,7 @@ def main ():
cmd = SU_COMMAND.split()
subprocess.Popen(cmd+["%s --no-listener --shm %ld %ld %ld %s" % (sys.argv[0], mem.key, sig.key, rw.key, " ".join(additional))], env = env, close_fds = False)
- listener.set_recv(mem, sig, rw)
+ get_listener().set_recv(mem, sig, rw)
if __name__ == "__main__":
main()
diff --git a/portato/__init__.py b/portato/__init__.py
index 76c6198..4b6a808 100644
--- a/portato/__init__.py
+++ b/portato/__init__.py
@@ -58,5 +58,12 @@ logging.getLogger("portatoLogger").addHandler(handler)
logging.getLogger("portatoLogger").setLevel(logging.DEBUG)
logging.getLogger("portatoLogger").propagate = False
-from .plistener import PListener
-listener = PListener()
+__listener = None
+
+def get_listener():
+ global __listener
+ if __listener is None:
+ from .plistener import PListener
+ __listener = PListener()
+
+ return __listener
diff --git a/portato/gui/gtk/__init__.py b/portato/gui/gtk/__init__.py
index 5a02c00..14424b9 100644
--- a/portato/gui/gtk/__init__.py
+++ b/portato/gui/gtk/__init__.py
@@ -14,7 +14,7 @@ from __future__ import absolute_import
from gettext import lgettext as _
-from ... import listener
+from ... import get_listener
from .exception_handling import register_ex_handler
def run ():
@@ -30,7 +30,7 @@ def run ():
except KeyboardInterrupt:
pass
- listener.close()
+ get_listener().close()
def show_ebuild (pkg):
import gtk
diff --git a/portato/gui/gtk/windows.py b/portato/gui/gtk/windows.py
index e3bf133..b17c00c 100644
--- a/portato/gui/gtk/windows.py
+++ b/portato/gui/gtk/windows.py
@@ -23,7 +23,7 @@ from subprocess import Popen
from gettext import lgettext as _
# our backend stuff
-from ... import listener, plugin
+from ... import get_listener, plugin
from ...helper import debug, warning, error, unique_array
from ...constants import CONFIG_LOCATION, VERSION, APP_ICON, DATA_DIR
from ...backend import flags, system
@@ -335,7 +335,7 @@ class PreferenceWindow (AbstractDialog):
self.cfg.set("consolefont", font, section = "GTK")
self.set_console_font(font)
- gtk.link_button_set_uri_hook(lambda btn, x: listener.send_cmd([self.cfg.get("browserCmd", section = "GUI"), btn.get_uri()]))
+ gtk.link_button_set_uri_hook(lambda btn, x: get_listener().send_cmd([self.cfg.get("browserCmd", section = "GUI"), btn.get_uri()]))
def cb_ok_clicked(self, button):
"""Saves, writes to config-file and closes the window."""
@@ -912,7 +912,7 @@ class MainWindow (Window):
raise
self.cfg.modify_external_configs()
- gtk.link_button_set_uri_hook(lambda btn, x: listener.send_cmd([self.cfg.get("browserCmd", section = "GUI"), btn.get_uri()]))
+ gtk.link_button_set_uri_hook(lambda btn, x: get_listener().send_cmd([self.cfg.get("browserCmd", section = "GUI"), btn.get_uri()]))
gtk.about_dialog_set_url_hook(lambda *args: True) # dummy - if not set link is not set as link; if link is clicked the normal uuri_hook is called too - thus do not call browser here
# set plugins and plugin-menu
diff --git a/portato/plugins/notify.py b/portato/plugins/notify.py
index db024cf..ae2addd 100644
--- a/portato/plugins/notify.py
+++ b/portato/plugins/notify.py
@@ -1,7 +1,7 @@
from gettext import lgettext as _
import pynotify
-from portato import listener
+from portato import get_listener
from portato.helper import warning, error, debug
from portato.constants import APP_ICON, APP
@@ -20,4 +20,4 @@ def notify (retcode, **kwargs):
descr = _("Error Code: %d") % retcode
urgency = pynotify.URGENCY_CRITICAL
- listener.send_notify(base = text, descr = descr, icon = icon, urgency = urgency)
+ get_listener().send_notify(base = text, descr = descr, icon = icon, urgency = urgency)
rent places in the same application. For example, on Solaris Git uses it's "compat" regex library which has a different sized regex_t structure than that available in the platform regex.h. This has a knock-on effect on the size of "struct rev_info" and leads to hard to diagnose runtime issues. In order to avoid all of this, introduce a "cgit.mk" file that includes Git's Makefile and make all of the existing logic apply to CGit's objects as well. This is slightly complicated because Git's Makefile must run in Git's directory, so all references to CGit files need to be prefixed with "../". In addition, OBJECTS is a simply expanded variable in Git's Makefile so we cannot just add our objects to it. Instead we must copy the two applicable rules into "cgit.mk". This has the advantage that we can split CGit-specific CFLAGS from Git's CFLAGS and hence avoid rebuilding all of Git whenever a CGit-specific value changes. Signed-off-by: John Keeping <john@keeping.me.uk> Acked-by: Jamie Couture <jamie.couture@gmail.com>