[med-svn] r1275 - trunk/community/infrastructure/test

tille at alioth.debian.org tille at alioth.debian.org
Sun Feb 3 12:12:56 UTC 2008


Author: tille
Date: 2008-02-03 12:12:56 +0000 (Sun, 03 Feb 2008)
New Revision: 1275

Modified:
   trunk/community/infrastructure/test/cddtasktools.py
   trunk/community/infrastructure/test/update-tasks_using_python-debian
Log:
Implement sorted list of dependencies


Modified: trunk/community/infrastructure/test/cddtasktools.py
===================================================================
--- trunk/community/infrastructure/test/cddtasktools.py	2008-02-03 09:54:11 UTC (rev 1274)
+++ trunk/community/infrastructure/test/cddtasktools.py	2008-02-03 12:12:56 UTC (rev 1275)
@@ -89,6 +89,14 @@
                                    # WNPP bug and finally can be used for packaging
         self.pkgURL         = None # URL of inofficial package
 
+    # sort this objects according to the package name
+    def __cmp__(self, other):
+        # Comparing with None object has to return something reasonable
+        if other == None:
+            return -2
+        # Sort according to package name
+        return cmp(self.pkg, other.pkg)
+
 class CddDependencies:
     # Provide a list of depencencies defined in Metapackages
 
@@ -135,6 +143,8 @@
             print >>sys.stderr, "No such task file %s." % self.taskfile
             return None
 
+        # Dictionary with dependencytype as key and list of DependantPackage
+        # instances
         self.dependencies = { 'official'    : [],
                               'unofficial'  : [],
                               'prospective' : []
@@ -255,6 +265,10 @@
                 
         f.close()
 
+        for dependency in self.dependencies.keys():
+            self.dependencies[dependency].sort()
+
+
     def _FindDependencyType(self, dep):
         # Return the name of the Dependencytype to append the Dependency to the right list
         if dep.component != {}:

Modified: trunk/community/infrastructure/test/update-tasks_using_python-debian
===================================================================
--- trunk/community/infrastructure/test/update-tasks_using_python-debian	2008-02-03 09:54:11 UTC (rev 1274)
+++ trunk/community/infrastructure/test/update-tasks_using_python-debian	2008-02-03 12:12:56 UTC (rev 1275)
@@ -20,9 +20,6 @@
 from cddtasktools import Available, CddDependencies, Task, TaskDependencies
 
 
-def sorter(x, y):
-	return cmp(x.pkg,y.pkg)
-
 tdeps=TaskDependencies('debian-med', 'bio')
 tdeps.GetTaskDependencies()
 
@@ -40,15 +37,6 @@
 
 sys.exit(0)
 
-print "---------- prospective - sorted  ----------"
-for tdep in tdeps.dependencies['prospective'].sort(sorter):
-    print tdep.pkg, ':', tdep.pkgShortDesc
-
-#for k in ksort(d):
-#print k, v
-
-sys.exit(0)
-
 deps=CddDependencies('debian-science')
 deps.GetTasks()
 




More information about the debian-med-commit mailing list