core: provide package_list() and utilize in issue-diff.py.
This commit is contained in:
parent
a575f0d801
commit
98397ea758
@ -21,6 +21,7 @@ import osc.conf
|
||||
import osc.core
|
||||
|
||||
from osclib.cache import Cache
|
||||
from osclib.core import package_list
|
||||
|
||||
# Issue summary can contain unicode characters and therefore a string containing
|
||||
# either summary or one in which ISSUE_SUMMARY is then placed must be unicode.
|
||||
@ -204,16 +205,6 @@ def issues_get(apiurl, project, package, trackers, db):
|
||||
|
||||
return issues
|
||||
|
||||
def package_list(apiurl, project):
|
||||
url = osc.core.makeurl(apiurl, ['source', project], { 'expand': 1 })
|
||||
root = ET.parse(osc.core.http_GET(url)).getroot()
|
||||
|
||||
packages = []
|
||||
for package in root.findall('entry'):
|
||||
packages.append(package.get('name'))
|
||||
|
||||
return sorted(packages)
|
||||
|
||||
def git_clone(url, directory):
|
||||
return_code = subprocess.call(['git', 'clone', url, directory])
|
||||
if return_code != 0:
|
||||
|
17
osclib/core.py
Normal file
17
osclib/core.py
Normal file
@ -0,0 +1,17 @@
|
||||
from xml.etree import cElementTree as ET
|
||||
|
||||
from osc.core import http_GET
|
||||
from osc.core import makeurl
|
||||
|
||||
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)
|
Loading…
x
Reference in New Issue
Block a user