Commits

Anonymous committed e373254

Add methods to get provides ans requires

  • Participants
  • Parent commits e8fbb62

Comments (0)

Files changed (1)

         safe_execute(cursor, 'update packages set autohide=%s where name=%s',
                      [value, name])
 
-    def get_package_require_dist(self, name, version):
+    def get_package_requires_dist(self, name, version):
         cursor = self.get_cursor()
         safe_execute(cursor, '''select specifier from release_requires_dist 
             where name=%s and version=%s ''', (name, version))
-        return Result(None, cursor.fetchall(), self._Package_Roles)
+        packages = []
+        for package in cursor.fetchall():
+            pack = {'name':package[0],
+                    'href' :"%s/%s"%(self.config.url, package[0])}
+            packages.append(pack)
+        return packages
+
+    def get_package_provides_dist(self, name, version):
+        cursor = self.get_cursor()
+        safe_execute(cursor, '''select specifier from release_provides_dist 
+            where name=%s and version=%s ''', (name, version))
+        packages = []
+        for package in cursor.fetchall():
+            pack = {'name':package[0],
+                    'href' :"%s/%s"%(self.config.url, package[0])}
+            packages.append(pack)
+        return packages
 
     def get_package_project_url(self, name, version):
         cursor = self.get_cursor()
         safe_execute(cursor, '''select specifier from release_project_url 
             where name=%s and version=%s ''', (name, version))
-        return Result(None, cursor.fetchall(), self._Package_Roles)
+        project_urls = []
+        for project in cursor.fetchall():
+            project_urls.append(project[0].split(','))
+        return project_urls
 
     def get_package_comments(self, name):
         cursor = self.get_cursor()