mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-13 09:16:14 +01:00
core.py: add missing spaces
Add missing spaces around operators and spaces after comma. Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
This commit is contained in:
parent
3ac21eb1e3
commit
f889edabfa
56
osc/core.py
56
osc/core.py
@ -1423,7 +1423,7 @@ class Package:
|
|||||||
# if sinfo is None another commit might have occured in the "meantime"
|
# if sinfo is None another commit might have occured in the "meantime"
|
||||||
sinfo = sfilelist.find('serviceinfo')
|
sinfo = sfilelist.find('serviceinfo')
|
||||||
print('')
|
print('')
|
||||||
rev=self.latest_rev()
|
rev = self.latest_rev()
|
||||||
self.update(rev=rev)
|
self.update(rev=rev)
|
||||||
|
|
||||||
def __write_storelist(self, name, data):
|
def __write_storelist(self, name, data):
|
||||||
@ -2633,9 +2633,9 @@ def shorttime(t):
|
|||||||
|
|
||||||
if time.localtime()[0] == time.localtime(t)[0]:
|
if time.localtime()[0] == time.localtime(t)[0]:
|
||||||
# same year
|
# same year
|
||||||
return time.strftime('%b %d %H:%M',time.localtime(t))
|
return time.strftime('%b %d %H:%M', time.localtime(t))
|
||||||
else:
|
else:
|
||||||
return time.strftime('%b %d %Y',time.localtime(t))
|
return time.strftime('%b %d %Y', time.localtime(t))
|
||||||
|
|
||||||
|
|
||||||
def is_project_dir(d):
|
def is_project_dir(d):
|
||||||
@ -2935,7 +2935,7 @@ def http_request(method, url, headers={}, data=None, file=None, timeout=100):
|
|||||||
socket.setdefaulttimeout(timeout)
|
socket.setdefaulttimeout(timeout)
|
||||||
try:
|
try:
|
||||||
if isinstance(data, str):
|
if isinstance(data, str):
|
||||||
data=bytes(data, "utf-8")
|
data = bytes(data, "utf-8")
|
||||||
fd = urlopen(req, data=data)
|
fd = urlopen(req, data=data)
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
@ -3084,7 +3084,7 @@ def show_package_meta(apiurl, prj, pac, meta=False):
|
|||||||
|
|
||||||
|
|
||||||
def show_attribute_meta(apiurl, prj, pac, subpac, attribute, with_defaults, with_project):
|
def show_attribute_meta(apiurl, prj, pac, subpac, attribute, with_defaults, with_project):
|
||||||
path=[]
|
path = []
|
||||||
path.append('source')
|
path.append('source')
|
||||||
path.append(prj)
|
path.append(prj)
|
||||||
if pac:
|
if pac:
|
||||||
@ -3094,7 +3094,7 @@ def show_attribute_meta(apiurl, prj, pac, subpac, attribute, with_defaults, with
|
|||||||
path.append('_attribute')
|
path.append('_attribute')
|
||||||
if attribute:
|
if attribute:
|
||||||
path.append(attribute)
|
path.append(attribute)
|
||||||
query=[]
|
query = []
|
||||||
if with_defaults:
|
if with_defaults:
|
||||||
query.append("with_default=1")
|
query.append("with_default=1")
|
||||||
if with_project:
|
if with_project:
|
||||||
@ -3303,7 +3303,7 @@ def edit_meta(metatype,
|
|||||||
change_is_required = True
|
change_is_required = True
|
||||||
|
|
||||||
url = make_meta_url(metatype, path_args, apiurl, force, remove_linking_repositories)
|
url = make_meta_url(metatype, path_args, apiurl, force, remove_linking_repositories)
|
||||||
f=metafile(url, data, change_is_required, metatypes[metatype]['file_ext'])
|
f = metafile(url, data, change_is_required, metatypes[metatype]['file_ext'])
|
||||||
|
|
||||||
if edit:
|
if edit:
|
||||||
f.edit()
|
f.edit()
|
||||||
@ -3586,20 +3586,20 @@ def create_submit_request(apiurl,
|
|||||||
message="", orev=None, src_update=None):
|
message="", orev=None, src_update=None):
|
||||||
|
|
||||||
import cgi
|
import cgi
|
||||||
options_block=""
|
options_block = ""
|
||||||
package=""
|
package = ""
|
||||||
if src_package:
|
if src_package:
|
||||||
package="""package="%s" """ % (src_package)
|
package = """package="%s" """ % (src_package)
|
||||||
if src_update:
|
if src_update:
|
||||||
options_block="""<options><sourceupdate>%s</sourceupdate></options> """ % (src_update)
|
options_block = """<options><sourceupdate>%s</sourceupdate></options> """ % (src_update)
|
||||||
|
|
||||||
# Yes, this kind of xml construction is horrible
|
# Yes, this kind of xml construction is horrible
|
||||||
targetxml = ""
|
targetxml = ""
|
||||||
if dst_project:
|
if dst_project:
|
||||||
packagexml = ""
|
packagexml = ""
|
||||||
if dst_package:
|
if dst_package:
|
||||||
packagexml = """package="%s" """ %( dst_package )
|
packagexml = """package="%s" """ % ( dst_package )
|
||||||
targetxml = """<target project="%s" %s /> """ %( dst_project, packagexml )
|
targetxml = """<target project="%s" %s /> """ % ( dst_project, packagexml )
|
||||||
# XXX: keep the old template for now in order to work with old obs instances
|
# XXX: keep the old template for now in order to work with old obs instances
|
||||||
xml = """\
|
xml = """\
|
||||||
<request type="submit">
|
<request type="submit">
|
||||||
@ -3676,7 +3676,7 @@ def change_review_state(apiurl, reqid, newstate, by_user='', by_group='', by_pro
|
|||||||
return root.get('code')
|
return root.get('code')
|
||||||
|
|
||||||
def change_request_state(apiurl, reqid, newstate, message='', supersed=None, force=False):
|
def change_request_state(apiurl, reqid, newstate, message='', supersed=None, force=False):
|
||||||
query={'cmd': 'changestate', 'newstate': newstate }
|
query = {'cmd': 'changestate', 'newstate': newstate }
|
||||||
if supersed:
|
if supersed:
|
||||||
query['superseded_by'] = supersed
|
query['superseded_by'] = supersed
|
||||||
if force:
|
if force:
|
||||||
@ -3768,7 +3768,7 @@ def get_review_list(apiurl, project='', package='', byuser='', bygroup='', bypro
|
|||||||
requests.append(r)
|
requests.append(r)
|
||||||
return requests
|
return requests
|
||||||
|
|
||||||
def get_exact_request_list(apiurl, src_project, dst_project, src_package=None, dst_package=None, req_who=None, req_state=('new','review','declined'), req_type=None):
|
def get_exact_request_list(apiurl, src_project, dst_project, src_package=None, dst_package=None, req_who=None, req_state=('new', 'review', 'declined'), req_type=None):
|
||||||
xpath = ''
|
xpath = ''
|
||||||
if not 'all' in req_state:
|
if not 'all' in req_state:
|
||||||
for state in req_state:
|
for state in req_state:
|
||||||
@ -3799,7 +3799,7 @@ def get_exact_request_list(apiurl, src_project, dst_project, src_package=None, d
|
|||||||
requests.append(r)
|
requests.append(r)
|
||||||
return requests
|
return requests
|
||||||
|
|
||||||
def get_request_list(apiurl, project='', package='', req_who='', req_state=('new','review','declined'), req_type=None, exclude_target_projects=[]):
|
def get_request_list(apiurl, project='', package='', req_who='', req_state=('new', 'review', 'declined'), req_type=None, exclude_target_projects=[]):
|
||||||
xpath = ''
|
xpath = ''
|
||||||
if not 'all' in req_state:
|
if not 'all' in req_state:
|
||||||
for state in req_state:
|
for state in req_state:
|
||||||
@ -3841,7 +3841,7 @@ def get_request_list(apiurl, project='', package='', req_who='', req_state=('new
|
|||||||
return requests
|
return requests
|
||||||
|
|
||||||
# old style search, this is to be removed
|
# old style search, this is to be removed
|
||||||
def get_user_projpkgs_request_list(apiurl, user, req_state=('new','review',), req_type=None, exclude_projects=[], projpkgs={}):
|
def get_user_projpkgs_request_list(apiurl, user, req_state=('new', 'review', ), req_type=None, exclude_projects=[], projpkgs={}):
|
||||||
"""OBSOLETE: user involved request search is supported by OBS 2.2 server side in a better way
|
"""OBSOLETE: user involved request search is supported by OBS 2.2 server side in a better way
|
||||||
Return all running requests for all projects/packages where is user is involved"""
|
Return all running requests for all projects/packages where is user is involved"""
|
||||||
if not projpkgs:
|
if not projpkgs:
|
||||||
@ -4716,18 +4716,18 @@ def copy_pac(src_apiurl, src_project, src_package,
|
|||||||
|
|
||||||
|
|
||||||
def unlock_package(apiurl, prj, pac, msg):
|
def unlock_package(apiurl, prj, pac, msg):
|
||||||
query={'cmd': 'unlock', 'comment': msg}
|
query = {'cmd': 'unlock', 'comment': msg}
|
||||||
u = makeurl(apiurl, ['source', prj, pac], query)
|
u = makeurl(apiurl, ['source', prj, pac], query)
|
||||||
http_POST(u)
|
http_POST(u)
|
||||||
|
|
||||||
def unlock_project(apiurl, prj, msg=None):
|
def unlock_project(apiurl, prj, msg=None):
|
||||||
query={'cmd': 'unlock', 'comment': msg}
|
query = {'cmd': 'unlock', 'comment': msg}
|
||||||
u = makeurl(apiurl, ['source', prj], query)
|
u = makeurl(apiurl, ['source', prj], query)
|
||||||
http_POST(u)
|
http_POST(u)
|
||||||
|
|
||||||
|
|
||||||
def undelete_package(apiurl, prj, pac, msg=None):
|
def undelete_package(apiurl, prj, pac, msg=None):
|
||||||
query={'cmd': 'undelete'}
|
query = {'cmd': 'undelete'}
|
||||||
if msg:
|
if msg:
|
||||||
query['comment'] = msg
|
query['comment'] = msg
|
||||||
else:
|
else:
|
||||||
@ -4736,7 +4736,7 @@ def undelete_package(apiurl, prj, pac, msg=None):
|
|||||||
http_POST(u)
|
http_POST(u)
|
||||||
|
|
||||||
def undelete_project(apiurl, prj, msg=None):
|
def undelete_project(apiurl, prj, msg=None):
|
||||||
query={'cmd': 'undelete'}
|
query = {'cmd': 'undelete'}
|
||||||
if msg:
|
if msg:
|
||||||
query['comment'] = msg
|
query['comment'] = msg
|
||||||
else:
|
else:
|
||||||
@ -4969,20 +4969,20 @@ def get_results(apiurl, prj, package, lastbuild=None, repository=[], arch=[], ve
|
|||||||
else:
|
else:
|
||||||
res['status'] += ': %s' % (res['details'], )
|
res['status'] += ': %s' % (res['details'], )
|
||||||
if res['dirty']:
|
if res['dirty']:
|
||||||
waiting=True
|
waiting = True
|
||||||
if verbose:
|
if verbose:
|
||||||
res['status'] = 'outdated (was: %s)' % res['status']
|
res['status'] = 'outdated (was: %s)' % res['status']
|
||||||
else:
|
else:
|
||||||
res['status'] += '*'
|
res['status'] += '*'
|
||||||
if res['code'] in ('blocked', 'scheduled', 'dispatching', 'building', 'signing', 'finished'):
|
if res['code'] in ('blocked', 'scheduled', 'dispatching', 'building', 'signing', 'finished'):
|
||||||
waiting=True
|
waiting = True
|
||||||
|
|
||||||
r.append(result_line_templ % res)
|
r.append(result_line_templ % res)
|
||||||
|
|
||||||
if printJoin:
|
if printJoin:
|
||||||
print(printJoin.join(r))
|
print(printJoin.join(r))
|
||||||
|
|
||||||
if wait==False or waiting==False:
|
if wait == False or waiting == False:
|
||||||
break
|
break
|
||||||
|
|
||||||
return r
|
return r
|
||||||
@ -5358,7 +5358,7 @@ def print_jobhistory(apiurl, prj, current_package, repository, arch, format = 't
|
|||||||
et = int(node.get('endtime'))
|
et = int(node.get('endtime'))
|
||||||
endtime = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(et))
|
endtime = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(et))
|
||||||
waittm = time.gmtime(et-st)
|
waittm = time.gmtime(et-st)
|
||||||
if waittm.tm_mday>1:
|
if waittm.tm_mday > 1:
|
||||||
waitbuild = "%1dd %2dh %2dm %2ds" % (waittm.tm_mday-1, waittm.tm_hour, waittm.tm_min, waittm.tm_sec)
|
waitbuild = "%1dd %2dh %2dm %2ds" % (waittm.tm_mday-1, waittm.tm_hour, waittm.tm_min, waittm.tm_sec)
|
||||||
elif waittm.tm_hour:
|
elif waittm.tm_hour:
|
||||||
waitbuild = " %2dh %2dm %2ds" % (waittm.tm_hour, waittm.tm_min, waittm.tm_sec)
|
waitbuild = " %2dh %2dm %2ds" % (waittm.tm_hour, waittm.tm_min, waittm.tm_sec)
|
||||||
@ -5435,7 +5435,7 @@ def get_commitlog(apiurl, prj, package, revision, format = 'text', meta = False,
|
|||||||
r.append('</logentry>')
|
r.append('</logentry>')
|
||||||
else:
|
else:
|
||||||
if requestid:
|
if requestid:
|
||||||
requestid="rq" + requestid
|
requestid = "rq" + requestid
|
||||||
s = '-' * 76 + \
|
s = '-' * 76 + \
|
||||||
'\nr%s | %s | %s | %s | %s | %s\n' % (rev, user, t, srcmd5, version, requestid) + \
|
'\nr%s | %s | %s | %s | %s | %s\n' % (rev, user, t, srcmd5, version, requestid) + \
|
||||||
'\n' + comment
|
'\n' + comment
|
||||||
@ -5833,7 +5833,7 @@ def set_link_rev(apiurl, project, package, revision='', expand=False, baserev=Fa
|
|||||||
# set revision element
|
# set revision element
|
||||||
src_project = root.get('project', project)
|
src_project = root.get('project', project)
|
||||||
src_package = root.get('package', package)
|
src_package = root.get('package', package)
|
||||||
linkrev=None
|
linkrev = None
|
||||||
vrev = None
|
vrev = None
|
||||||
if baserev:
|
if baserev:
|
||||||
linkrev = 'base'
|
linkrev = 'base'
|
||||||
@ -6298,7 +6298,7 @@ def get_commit_msg(wc_dir, pacs):
|
|||||||
store_unlink_file(wc_dir, '_commit_msg')
|
store_unlink_file(wc_dir, '_commit_msg')
|
||||||
return msg
|
return msg
|
||||||
|
|
||||||
def print_request_list(apiurl, project, package = None, states = ('new','review',), force = False):
|
def print_request_list(apiurl, project, package = None, states = ('new', 'review', ), force = False):
|
||||||
"""
|
"""
|
||||||
prints list of pending requests for the specified project/package if "check_for_request_on_action"
|
prints list of pending requests for the specified project/package if "check_for_request_on_action"
|
||||||
is enabled in the config or if "force" is set to True
|
is enabled in the config or if "force" is set to True
|
||||||
|
Loading…
Reference in New Issue
Block a user