Merged revisions 1884-1905 via svnmerge from
[scons.git] / bin / objcounts.py
index 7aa293b70d2265cb3670dedbd189b61f503a81d1..db02aab4fc21b192791aa58fa20f9e33e7a0f09d 100644 (file)
@@ -35,7 +35,7 @@ Compare the --debug=object counts from two build logs.
 
 def fetch_counts(fname):
     contents = open(fname).read()
-    m = re.search('\nObject counts:\n(.*)\n[^\s]', contents, re.S)
+    m = re.search('\nObject counts:(\n\s[^\n]*)*', contents, re.S)
     lines = m.group().split('\n')
     list = [l.split() for l in lines if re.match('\s+\d', l)]
     d = {}
@@ -51,7 +51,19 @@ for k in c1.keys():
     try:
         common[k] = (c1[k], c2[k])
     except KeyError:
-        pass
+        # Transition:  we added the module to the names of a bunch of
+        # the logged objects.  Assume that c1 might be from an older log
+        # without the modules in the names, and look for an equivalent
+        # in c2.
+        if not '.' in k:
+            s = '.'+k
+            l = len(s)
+            for k2 in c2.keys():
+                if k2[-l:] == s:
+                    common[k2] = (c1[k], c2[k2])
+                    del c1[k]
+                    del c2[k2]
+                    break
     else:
         del c1[k]
         del c2[k]