[csw-devel] SF.net SVN: gar:[11938] csw/mgar/gar/v2/lib/python

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Wed Dec 15 00:22:27 CET 2010


Revision: 11938
          http://gar.svn.sourceforge.net/gar/?rev=11938&view=rev
Author:   wahwah
Date:     2010-12-14 23:22:27 +0000 (Tue, 14 Dec 2010)

Log Message:
-----------
checkpkg: Keep pkgmap in order sorted by path

This should make it easier to compare two packages by looking at their
pretty-printed stats data structures.

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/python/opencsw.py
    csw/mgar/gar/v2/lib/python/opencsw_test.py

Modified: csw/mgar/gar/v2/lib/python/opencsw.py
===================================================================
--- csw/mgar/gar/v2/lib/python/opencsw.py	2010-12-14 23:21:55 UTC (rev 11937)
+++ csw/mgar/gar/v2/lib/python/opencsw.py	2010-12-14 23:22:27 UTC (rev 11938)
@@ -569,6 +569,7 @@
     self.entries_by_type = IndexDictsBy(self.entries, "type")
     self.entries_by_class = IndexDictsBy(self.entries, "class")
     self.entries_by_path = IndexDictsBy(self.entries, "path")
+    self.entries = sorted(self.entries, key=lambda x: x["path"])
 
   def GetClasses(self):
     """The assumtion is that the set of classes never changes."""

Modified: csw/mgar/gar/v2/lib/python/opencsw_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/opencsw_test.py	2010-12-14 23:21:55 UTC (rev 11937)
+++ csw/mgar/gar/v2/lib/python/opencsw_test.py	2010-12-14 23:22:27 UTC (rev 11938)
@@ -413,6 +413,11 @@
     pkgmap = opencsw.Pkgmap(PKGMAP_3.splitlines())
     self.assertTrue("build" in pkgmap.entries_by_class)
 
+  def testPkgmapSortedByPaths(self):
+    pkgmap = opencsw.Pkgmap(PKGMAP_2.splitlines())
+    paths = [x["path"] for x in pkgmap.entries]
+    self.assertEquals(paths, sorted(paths))
+
 class IndexByUnitTest(unittest.TestCase):
 
   def testIndexDictsBy_1(self):


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


More information about the devel mailing list