[sysadmin-bin] py-install-module: make ModuleInfo keep track of all files it ignored



commit 945372c272c16e88fcc8f49c49e17501f77300a1
Author: Olav Vitters <olav vitters nl>
Date:   Mon Mar 7 14:27:49 2011 +0100

    py-install-module: make ModuleInfo keep track of all files it ignored

 py-install-module |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/py-install-module b/py-install-module
index 19a9159..29f329d 100755
--- a/py-install-module
+++ b/py-install-module
@@ -337,6 +337,7 @@ class ModuleInfo(BasicInfo):
 
         info = {}
         majmins = {}
+        ignored = {}
         changed = False
 
         if not os.path.exists(self.jsonfile):
@@ -374,10 +375,14 @@ class ModuleInfo(BasicInfo):
                             version = fileinfo['version']
                             format = fileinfo['format']
 
-                            if module != self.module:
+                            if module == self.module:
+                                info.setdefault(version, {})[format] = os.path.join(root, filename)
                                 continue
 
-                            info.setdefault(version, {})[format] = os.path.join(root, filename)
+                        # If we arrive here, it means we ignored the file for some reason
+                        if root not in ignored:
+                            ignored[root] = []
+                        ignored[root].append(filename)
             finally:
                 os.chdir(curdir)
 
@@ -394,6 +399,10 @@ class ModuleInfo(BasicInfo):
         self.info = info
         self.majmin = majmins
         self.versions = sorted(info, version_cmp)
+        self.ignored = ignored
+
+#        if DEBUG:
+#            pprint.pprint(ignored)
 
         if changed:
             # save the new information
@@ -439,7 +448,7 @@ class ModuleInfo(BasicInfo):
         if self.module is None: return False
 
         info = self.info
-        json.dump((self.JSONVERSION, info), open(self.jsonfile, 'w'))
+        json.dump((self.JSONVERSION, info, self.versions), open(self.jsonfile, 'w'))
         if self.GROUPID is not None:
             os.chown(self.jsonfile, -1, self.GROUPID)
 
@@ -873,6 +882,9 @@ Report bugs to gnome-sysadmin gnome org"""
 
     old_mask = os.umask(0002)
 
+    if DEBUG:
+        print "WARNING: Running in DEBUG MODE!"
+
     for file in tarballs:
         sys.stdout.write("Checking for info about %s" % file)
         handler = InstallModule(file)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]