[pkg-fso-commits] [SCM] FSO frameworkd Debian packaging branch, master, updated. milestone4-368-g700ab82

Michael 'Mickey' Lauer mickey at vanille-media.de
Mon Feb 2 18:51:27 UTC 2009


The following commit has been merged in the master branch:
commit 54284f9a467358e638945a110bb86c73c84a4244
Author: Michael 'Mickey' Lauer <mickey at vanille-media.de>
Date:   Fri Nov 28 15:58:58 2008 +0100

    MAJOR BUGFIX:
    Stop importing modules by full name, instead append the subsystem to sys.path,
    by that we workaround modules getting imported twice, once as (e.g.
    <framework.subsystems.ogsmd.modems.abstract.calling> and
    <ogsmd.modems.abstract.calling>. Apparantly, if you are using __import__, you
    bypass the usual Python module import checks that should prevent modules from
    getting imported twice with different namespaces. D'oh. Anyways, this fixes a
    lot of potential problems with our classmethods, singletons, etc.
    It should also reduce memory consumption and lookup time a bit.

diff --git a/framework/controller.py b/framework/controller.py
index e57aafb..d397bb8 100644
--- a/framework/controller.py
+++ b/framework/controller.py
@@ -48,6 +48,7 @@ class Controller( daemon.Daemon ):
         return cls.objects[name]
 
     def __init__( self, path, options ):
+        sys.path.append( path ) # to enable 'from <subsystemname> import ...' and 'import <subsystemname>'
         self.launchTime = time.time()
         self.options = options
         daemon.Daemon.__init__( self, "/tmp/frameworkd.pid" )
diff --git a/framework/subsystem.py b/framework/subsystem.py
index 331e5fa..eb3cb97 100644
--- a/framework/subsystem.py
+++ b/framework/subsystem.py
@@ -10,7 +10,7 @@ Module: subsystem
 """
 
 MODULE_NAME = "frameworkd.subsystem"
-__version__ = "1.0.0"
+__version__ = "1.0.1"
 
 from .config import config, DBUS_BUS_NAME_PREFIX
 
@@ -69,7 +69,7 @@ class Subsystem( object ):
                         logger.info( "skipping module %s.%s as requested via config file." % ( self.name, modulename ) )
                         continue
                     module = __import__(
-                        name = ".".join( ["framework.subsystems", self.name, modulename] ),
+                        name = "%s.%s" % ( self.name, modulename ),
                         fromlist = ["factory"],
                         level = 0
                     )

-- 
FSO frameworkd Debian packaging



More information about the pkg-fso-commits mailing list