28 lines
755 B
Python
28 lines
755 B
Python
from xml.etree import cElementTree as ET
|
|
|
|
from osc.core import http_GET
|
|
from osc.core import makeurl
|
|
from osc.core import show_project_meta
|
|
|
|
from osclib.memoize import memoize
|
|
|
|
@memoize(session=True)
|
|
def package_list(apiurl, project):
|
|
url = makeurl(apiurl, ['source', project], { 'expand': 1 })
|
|
root = ET.parse(http_GET(url)).getroot()
|
|
|
|
packages = []
|
|
for package in root.findall('entry'):
|
|
packages.append(package.get('name'))
|
|
|
|
return sorted(packages)
|
|
|
|
@memoize(session=True)
|
|
def target_archs(apiurl, project):
|
|
meta = show_project_meta(apiurl, project)
|
|
meta = ET.fromstring(''.join(meta))
|
|
archs = []
|
|
for arch in meta.findall('repository[@name="standard"]/arch'):
|
|
archs.append(arch.text)
|
|
return archs
|