mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-27 02:16:12 +01:00
- useless use of StringIO()
This commit is contained in:
parent
b3c8cc9062
commit
0a6ca4f6c2
@ -4010,12 +4010,12 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
if len(args) == 1:
|
||||
prj = args[0]
|
||||
m = show_project_meta(conf.config['apiurl'], prj)
|
||||
tree = ET.parse(StringIO(''.join(m)))
|
||||
tree = ET.fromstring(''.join(m))
|
||||
elif len(args) == 2:
|
||||
prj = args[0]
|
||||
pac = args[1]
|
||||
m = show_package_meta(conf.config['apiurl'], prj, pac)
|
||||
tree = ET.parse(StringIO(''.join(m)))
|
||||
tree = ET.fromstring(''.join(m))
|
||||
if not opts.nodevelproject and not opts.delete and not opts.add:
|
||||
while tree.findall('devel'):
|
||||
d = tree.find('devel')
|
||||
@ -4024,11 +4024,11 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
if opts.verbose:
|
||||
print "Following to the development space:", prj, "/", pac
|
||||
m = show_package_meta(conf.config['apiurl'], prj, pac)
|
||||
tree = ET.parse(StringIO(''.join(m)))
|
||||
tree = ET.fromstring(''.join(m))
|
||||
if not tree.findall('person'):
|
||||
print "No dedicated persons in package defined, showing the project persons !"
|
||||
m = show_project_meta(conf.config['apiurl'], prj)
|
||||
tree = ET.parse(StringIO(''.join(m)))
|
||||
tree = ET.fromstring(''.join(m))
|
||||
else:
|
||||
raise oscerr.WrongArgs('I need at least one argument.')
|
||||
|
||||
@ -4205,7 +4205,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
u = makeurl(apiurl, ['source', prj, package], query=query)
|
||||
f = http_GET(u)
|
||||
meta = f.readlines()
|
||||
root_new = ET.parse(StringIO(''.join(meta))).getroot()
|
||||
root_new = ET.fromstring(''.join(meta)).getroot()
|
||||
dir_new = { 'apiurl': apiurl, 'project': prj, 'package': package }
|
||||
dir_new['srcmd5'] = root_new.get('srcmd5')
|
||||
dir_new['entries'] = [[n.get('name'), n.get('md5')] for n in root_new.findall('entry')]
|
||||
|
16
osc/core.py
16
osc/core.py
@ -2097,7 +2097,7 @@ def show_attribute_meta(apiurl, prj, pac, subpac, attribute, with_defaults, with
|
||||
def show_develproject(apiurl, prj, pac):
|
||||
m = show_package_meta(apiurl, prj, pac)
|
||||
try:
|
||||
return ET.parse(StringIO(''.join(m))).getroot().find('devel').get('project')
|
||||
return ET.fromstring(''.join(m)).getroot().find('devel').get('project')
|
||||
except:
|
||||
return None
|
||||
|
||||
@ -2301,14 +2301,14 @@ def show_files_meta(apiurl, prj, pac, revision=None, expand=False, linkrev=None,
|
||||
|
||||
def show_upstream_srcmd5(apiurl, prj, pac, expand=False, revision=None):
|
||||
m = show_files_meta(apiurl, prj, pac, expand=expand, revision=revision)
|
||||
return ET.parse(StringIO(''.join(m))).getroot().get('srcmd5')
|
||||
return ET.fromstring(''.join(m)).getroot().get('srcmd5')
|
||||
|
||||
|
||||
def show_upstream_xsrcmd5(apiurl, prj, pac, revision=None, linkrev=None, linkrepair=False):
|
||||
m = show_files_meta(apiurl, prj, pac, revision=revision, linkrev=linkrev, linkrepair=linkrepair)
|
||||
try:
|
||||
# only source link packages have a <linkinfo> element.
|
||||
li_node = ET.parse(StringIO(''.join(m))).getroot().find('linkinfo')
|
||||
li_node = ET.fromstring(''.join(m)).getroot().find('linkinfo')
|
||||
except:
|
||||
return None
|
||||
|
||||
@ -2322,7 +2322,7 @@ def show_upstream_xsrcmd5(apiurl, prj, pac, revision=None, linkrev=None, linkrep
|
||||
|
||||
def show_upstream_rev(apiurl, prj, pac):
|
||||
m = show_files_meta(apiurl, prj, pac)
|
||||
return ET.parse(StringIO(''.join(m))).getroot().get('rev')
|
||||
return ET.fromstring(''.join(m)).getroot().get('rev')
|
||||
|
||||
|
||||
def read_meta_from_spec(specfile, *args):
|
||||
@ -3320,7 +3320,7 @@ def get_platforms_of_project(apiurl, prj):
|
||||
|
||||
def get_repositories_of_project(apiurl, prj):
|
||||
f = show_project_meta(apiurl, prj)
|
||||
tree = ET.parse(StringIO(''.join(f)))
|
||||
tree = ET.fromstring(''.join(f))
|
||||
|
||||
r = [ node.get('name') for node in tree.findall('repository')]
|
||||
return r
|
||||
@ -3338,7 +3338,7 @@ class Repo:
|
||||
|
||||
def get_repos_of_project(apiurl, prj):
|
||||
f = show_project_meta(apiurl, prj)
|
||||
tree = ET.parse(StringIO(''.join(f)))
|
||||
tree = ET.fromstring(''.join(f))
|
||||
|
||||
for node in tree.findall('repository'):
|
||||
for node2 in node.findall('arch'):
|
||||
@ -3396,7 +3396,7 @@ def get_results(apiurl, prj, package, lastbuild=None, repository=[], arch=[]):
|
||||
result_line_templ = '%(rep)-15s %(arch)-10s %(status)s'
|
||||
|
||||
f = show_results_meta(apiurl, prj, package, lastbuild, repository, arch)
|
||||
tree = ET.parse(StringIO(''.join(f)))
|
||||
tree = ET.fromstring(''.join(f))
|
||||
root = tree.getroot()
|
||||
|
||||
for node in root.findall('result'):
|
||||
@ -3431,7 +3431,7 @@ def get_prj_results(apiurl, prj, hide_legend=False, csv=False, status_filter=Non
|
||||
result_line_templ = '%(rep)-15s %(arch)-10s %(status)s'
|
||||
|
||||
f = show_prj_results_meta(apiurl, prj)
|
||||
tree = ET.parse(StringIO(''.join(f)))
|
||||
tree = ET.fromstring(''.join(f))
|
||||
root = tree.getroot()
|
||||
|
||||
pacs = []
|
||||
|
Loading…
Reference in New Issue
Block a user