summaryrefslogtreecommitdiffstats
path: root/chitin
diff options
context:
space:
mode:
Diffstat (limited to 'chitin')
-rw-r--r--chitin/__init__.pyobin178 -> 0 bytes
-rw-r--r--chitin/parser.py11
2 files changed, 8 insertions, 3 deletions
diff --git a/chitin/__init__.pyo b/chitin/__init__.pyo
deleted file mode 100644
index 2f4bca1..0000000
--- a/chitin/__init__.pyo
+++ /dev/null
Binary files differ
diff --git a/chitin/parser.py b/chitin/parser.py
index 006d3a5..0a17979 100644
--- a/chitin/parser.py
+++ b/chitin/parser.py
@@ -21,7 +21,7 @@
# @author Izhar Firdaus <izhar@fedoraproject.com>
from xml.etree.ElementTree import ElementTree,Element
-import re, tempfile
+import re
from chitin.utils import attrsfilter,get_child_value
ocins='http://opensuse.org/Standards/One_Click_Install'
@@ -72,7 +72,7 @@ class Metapackage:
products = self.getGroup().getiterator('{%s}%s' % (ocins,'product'))
return attrsfilter(products,kwargs)
- def getRepoURL(self,reponame):
+ def getRepoURL(self,reponame,type=None):
"""
Function to get 'url' values from current distversion group, and requested reponame
@@ -83,11 +83,16 @@ class Metapackage:
repos = self.getRepositories()
urls = []
for r in repos:
- if get_child_value(r,'name') == reponame:
+ if get_child_value(r,'name').lower() == reponame.lower():
for url in r.getiterator('{%s}%s' % (ocins,'url')):
priority = 0
+ if type:
+ if not url.attrib.has_key('type'): continue
+ if not url.attrib['type'].lower() == type.lower(): continue
+
if url.attrib.has_key('score'): priority = int(url.attrib['score'])
urls.append((url.text.strip(),priority))
+
def sorturl(x,y):
if x[1] <= y[1]:
return +1