[Uludag-commits] r21984 - branches/comar-3.0/tools

uludag-commits at pardus.org.tr uludag-commits at pardus.org.tr
25 Mar 2009 Çar 15:11:45 EET


Author: bahadir.kandemir
Date: Wed Mar 25 15:11:45 2009
New Revision: 21984

Modified:
   branches/comar-3.0/tools/comar2to3.py
Log:
Better

Modified: branches/comar-3.0/tools/comar2to3.py
=================================================================
--- branches/comar-3.0/tools/comar2to3.py	(original)
+++ branches/comar-3.0/tools/comar2to3.py	Wed Mar 25 15:11:45 2009
@@ -19,15 +19,19 @@
 
     # If COMAR 3.0 database is already initialized, do nothing.
     init = False
-    for model in os.listdir(COMAR_DB_NEW):
-        files = os.listdir(os.path.join(COMAR_DB_NEW, model))
-        files.remove("comar.py")
-        if len(files):
-            init = True
-            break
-    if init:
-        print "COMAR database is already initialized."
-        return 0
+    ignore_comar = False
+    if os.path.exists(COMAR_DB_NEW):
+        for model in os.listdir(COMAR_DB_NEW):
+            files = os.listdir(os.path.join(COMAR_DB_NEW, model))
+            if "comar.py" in files:
+                files.remove("comar.py")
+                ignore_comar = True
+            if len(files):
+                init = True
+                break
+        if init:
+            print "COMAR database is already initialized."
+            return 0
 
     bus = dbus.SystemBus()
     obj = None
@@ -58,8 +62,8 @@
             _group, _class, _app = filename.split("_", 2)
             _model = "%s.%s" % (_group, _class)
             _app = _app.rsplit(".py", 1)[0]
-            # COMAR package always registers its packages to new daemon
-            if _app == "comar":
+            # If COMAR package is already registered, pass
+            if _app == "comar" and ignore_comar:
                 continue
             obj.register(_app, _model, os.path.join(COMAR_DB_OLD, filename), dbus_interface=COMAR_IFACE)
             print "Registering %s" % filename


Uludag-commits mesaj listesiyle ilgili daha fazla bilgi