From 96d242c00eca8c75c1d7d2fb487e53b5bc34155c Mon Sep 17 00:00:00 2001 From: Necoro <> Date: Mon, 14 Jan 2008 19:22:31 +0000 Subject: r617@Devoty: necoro | 2008-01-14 19:12:59 +0100 Remove unnecessairy loads of the shm module --- portato.py | 10 +++++----- portato/plistener.py | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/portato.py b/portato.py index b051a4a..42726ee 100755 --- a/portato.py +++ b/portato.py @@ -18,11 +18,6 @@ import sys, os, subprocess import gettext, locale from optparse import OptionParser, SUPPRESS_HELP -try: - import shm_wrapper as shm -except ImportError: - from portato.shm import shm_wrapper as shm - from portato import get_listener from portato.constants import VERSION, FRONTENDS, STD_FRONTEND, XSD_LOCATION, LOCALE_DIR, APP, SU_COMMAND @@ -104,6 +99,11 @@ def main (): else: # start us again in root modus and launch listener + try: + import shm_wrapper as shm + except ImportError: + from portato.shm import shm_wrapper as shm + mem = shm.create_memory(1024, permissions=0600) sig = shm.create_semaphore(InitialValue = 0, permissions = 0600) rw = shm.create_semaphore(InitialValue = 1, permissions = 0600) diff --git a/portato/plistener.py b/portato/plistener.py index a96f4b2..eb12606 100644 --- a/portato/plistener.py +++ b/portato/plistener.py @@ -16,11 +16,6 @@ import os from subprocess import Popen from gettext import lgettext as _ -try: - import shm_wrapper as shm -except ImportError: - from portato.shm import shm_wrapper as shm - try: import pynotify except ImportError: @@ -95,6 +90,11 @@ class PListener (object): self._sig = None self._rw = None else: + try: + import shm_wrapper as shm + except ImportError: + from portato.shm import shm_wrapper as shm + self._mem = shm.SharedMemoryHandle(mem) self._sig = shm.SemaphoreHandle(sig) self._rw = shm.SemaphoreHandle(rw) -- cgit v1.2.3-70-g09d2