1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-08-22 14:38:53 +02:00

commandline.py: add missing spaces

Add missing spaces around operators, add missing spaces after comma.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
This commit is contained in:
Danny Al-Gaaf
2013-05-27 12:41:50 +02:00
parent 439e03501d
commit 8403c92059

View File

@@ -483,7 +483,7 @@ class Osc(cmdln.Cmdln):
if opts.force or not filelist or not '_patchinfo' in filelist: if opts.force or not filelist or not '_patchinfo' in filelist:
print("Creating new patchinfo...") print("Creating new patchinfo...")
query='cmd=createpatchinfo&name=' + patchinfo query = 'cmd=createpatchinfo&name=' + patchinfo
if opts.force: if opts.force:
query += "&force=1" query += "&force=1"
url = makeurl(apiurl, ['source', project], query=query) url = makeurl(apiurl, ['source', project], query=query)
@@ -493,7 +493,7 @@ class Osc(cmdln.Cmdln):
patchinfo = p patchinfo = p
else: else:
print("Update existing _patchinfo file...") print("Update existing _patchinfo file...")
query='cmd=updatepatchinfo' query = 'cmd=updatepatchinfo'
url = makeurl(apiurl, ['source', project, patchinfo], query=query) url = makeurl(apiurl, ['source', project, patchinfo], query=query)
f = http_POST(url) f = http_POST(url)
@@ -918,9 +918,9 @@ class Osc(cmdln.Cmdln):
sr_ids = [] sr_ids = []
# for single request # for single request
actionxml = "" actionxml = ""
options_block="" options_block = ""
if src_update: if src_update:
options_block="""<options><sourceupdate>%s</sourceupdate></options> """ % (src_update) options_block = """<options><sourceupdate>%s</sourceupdate></options> """ % (src_update)
# loop via all packages for checking their state # loop via all packages for checking their state
for p in meta_get_packagelist(apiurl, project): for p in meta_get_packagelist(apiurl, project):
@@ -1082,7 +1082,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if not opts.diff: if not opts.diff:
sys.exit(1) sys.exit(1)
rev=opts.revision rev = opts.revision
if not rev: if not rev:
# get _link info from server, that knows about the local state ... # get _link info from server, that knows about the local state ...
u = makeurl(apiurl, ['source', src_project, src_package], query="expand=1") u = makeurl(apiurl, ['source', src_project, src_package], query="expand=1")
@@ -1090,17 +1090,17 @@ Please submit there instead, or use --nodevelproject to force direct submission.
root = ET.parse(f).getroot() root = ET.parse(f).getroot()
linkinfo = root.find('linkinfo') linkinfo = root.find('linkinfo')
if linkinfo == None: if linkinfo == None:
rev=root.get('rev') rev = root.get('rev')
else: else:
if linkinfo.get('project') != dst_project or linkinfo.get('package') != dst_package: if linkinfo.get('project') != dst_project or linkinfo.get('package') != dst_package:
# the submit target is not link target. use merged md5sum references to # the submit target is not link target. use merged md5sum references to
# avoid not mergable sources when multiple request from same source get created. # avoid not mergable sources when multiple request from same source get created.
rev=root.get('srcmd5') rev = root.get('srcmd5')
rdiff = None rdiff = None
if opts.diff or not opts.message: if opts.diff or not opts.message:
try: try:
rdiff = 'old: %s/%s\nnew: %s/%s rev %s\n' %(dst_project, dst_package, src_project, src_package, rev) rdiff = 'old: %s/%s\nnew: %s/%s rev %s\n' % (dst_project, dst_package, src_project, src_package, rev)
rdiff += server_diff(apiurl, rdiff += server_diff(apiurl,
dst_project, dst_package, None, dst_project, dst_package, None,
src_project, src_package, rev, True) src_project, src_package, rev, True)
@@ -1169,7 +1169,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
parser.values.actiondata.append(value) parser.values.actiondata.append(value)
def _submit_request(self, args, opts, options_block): def _submit_request(self, args, opts, options_block):
actionxml="" actionxml = ""
apiurl = self.get_api_url() apiurl = self.get_api_url()
if len(args) == 0 and is_project_dir(os.getcwd()): if len(args) == 0 and is_project_dir(os.getcwd()):
# submit requests for multiple packages are currently handled via multiple requests # submit requests for multiple packages are currently handled via multiple requests
@@ -1207,7 +1207,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if rdiff != '': if rdiff != '':
targetprojects.append(t) targetprojects.append(t)
pac.append(p) pac.append(p)
rdiffmsg.append("old: %s/%s\nnew: %s/%s\n%s" %(t, p, project, p,rdiff)) rdiffmsg.append("old: %s/%s\nnew: %s/%s\n%s" % (t, p, project, p,rdiff))
else: else:
print("Skipping package ", p, " since it has no difference with the target package.") print("Skipping package ", p, " since it has no difference with the target package.")
else: else:
@@ -1297,7 +1297,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
rdiff = None rdiff = None
if opts.diff: if opts.diff:
try: try:
rdiff = 'old: %s/%s\nnew: %s/%s\n' %(dst_project, dst_package, src_project, src_package) rdiff = 'old: %s/%s\nnew: %s/%s\n' % (dst_project, dst_package, src_project, src_package)
rdiff += server_diff(apiurl, rdiff += server_diff(apiurl,
dst_project, dst_package, opts.revision, dst_project, dst_package, opts.revision,
src_project, src_package, None, True) src_project, src_package, None, True)
@@ -1514,9 +1514,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
elif opts.no_update: elif opts.no_update:
src_update = "noupdate" src_update = "noupdate"
options_block="" options_block = ""
if src_update: if src_update:
options_block="""<options><sourceupdate>%s</sourceupdate></options> """ % (src_update) options_block = """<options><sourceupdate>%s</sourceupdate></options> """ % (src_update)
args = slash_split(args) args = slash_split(args)
@@ -1528,30 +1528,30 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if ai == 'submit': if ai == 'submit':
args = opts.actiondata[i] args = opts.actiondata[i]
i = i+1 i = i+1
actionsxml += self._submit_request(args,opts, options_block) actionsxml += self._submit_request(args, opts, options_block)
elif ai == 'delete': elif ai == 'delete':
args = opts.actiondata[i] args = opts.actiondata[i]
actionsxml += self._delete_request(args,opts) actionsxml += self._delete_request(args, opts)
i = i+1 i = i+1
elif ai == 'change_devel': elif ai == 'change_devel':
args = opts.actiondata[i] args = opts.actiondata[i]
actionsxml += self._changedevel_request(args,opts) actionsxml += self._changedevel_request(args, opts)
i = i+1 i = i+1
elif ai == 'add_me': elif ai == 'add_me':
args = opts.actiondata[i] args = opts.actiondata[i]
actionsxml += self._add_me(args,opts) actionsxml += self._add_me(args, opts)
i = i+1 i = i+1
elif ai == 'add_group': elif ai == 'add_group':
args = opts.actiondata[i] args = opts.actiondata[i]
actionsxml += self._add_group(args,opts) actionsxml += self._add_group(args, opts)
i = i+1 i = i+1
elif ai == 'add_role': elif ai == 'add_role':
args = opts.actiondata[i] args = opts.actiondata[i]
actionsxml += self._add_user(args,opts) actionsxml += self._add_user(args, opts)
i = i+1 i = i+1
elif ai == 'set_bugowner': elif ai == 'set_bugowner':
args = opts.actiondata[i] args = opts.actiondata[i]
actionsxml += self._set_bugowner(args,opts) actionsxml += self._set_bugowner(args, opts)
i = i+1 i = i+1
else: else:
raise oscerr.WrongArgs('Unsupported action %s' % ai) raise oscerr.WrongArgs('Unsupported action %s' % ai)
@@ -1682,12 +1682,12 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if not opts.message: if not opts.message:
import textwrap import textwrap
if package is not None: if package is not None:
footer=textwrap.TextWrapper(width = 66).fill( footer = textwrap.TextWrapper(width = 66).fill(
'please explain why you like to delete package %s of project %s' 'please explain why you like to delete package %s of project %s'
% (package,project)) % (package,project))
else: else:
footer=textwrap.TextWrapper(width = 66).fill( footer = textwrap.TextWrapper(width = 66).fill(
'please explain why you like to delete project %s' % project) 'please explain why you like to delete project %s' % project)
opts.message = edit_message(footer) opts.message = edit_message(footer)
r = Request() r = Request()
@@ -1732,9 +1732,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if not opts.message: if not opts.message:
import textwrap import textwrap
footer=textwrap.TextWrapper(width = 66).fill( footer = textwrap.TextWrapper(width = 66).fill(
'please explain why you like to change the devel project of %s/%s to %s/%s' 'please explain why you like to change the devel project of %s/%s to %s/%s'
% (project,package,devel_project,devel_package)) % (project,package,devel_project,devel_package))
opts.message = edit_message(footer) opts.message = edit_message(footer)
r = Request() r = Request()
@@ -2032,7 +2032,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
except ValueError: except ValueError:
days = 0 days = 0
if days > 0: if days > 0:
since = time.strftime('%Y-%m-%dT%H:%M:%S',time.localtime(time.time()-days*24*3600)) since = time.strftime('%Y-%m-%dT%H:%M:%S', time.localtime(time.time()-days*24*3600))
skipped = 0 skipped = 0
## bs has received 2009-09-20 a new xquery compare() function ## bs has received 2009-09-20 a new xquery compare() function
@@ -2158,7 +2158,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
rq = get_request(apiurl, reqid) rq = get_request(apiurl, reqid)
if opts.or_revoke: if opts.or_revoke:
if rq.state.name == "declined": if rq.state.name == "declined":
cmd="revoke" cmd = "revoke"
elif rq.state.name != "new" and rq.state.name != "review": elif rq.state.name != "new" and rq.state.name != "review":
return 0 return 0
if rq.state.name == state_map[cmd]: if rq.state.name == state_map[cmd]:
@@ -2213,7 +2213,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
print('Cannot get list of files for %s/%s: %s' % (project, package, e), file=sys.stderr) print('Cannot get list of files for %s/%s: %s' % (project, package, e), file=sys.stderr)
except SyntaxError as e: except SyntaxError as e:
print('Cannot parse list of files for %s/%s: %s' % (project, package, e), file=sys.stderr) print('Cannot parse list of files for %s/%s: %s' % (project, package, e), file=sys.stderr)
if links_to_project==action.tgt_project and links_to_package==action.tgt_package: if links_to_project == action.tgt_project and links_to_package == action.tgt_package:
# links to my request target anyway, no need to forward submit # links to my request target anyway, no need to forward submit
continue continue
@@ -3706,7 +3706,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
## ##
## if args[0] is already an url, the use it as is. ## if args[0] is already an url, the use it as is.
cmd = "sudo zypper -p http://download.opensuse.org/repositories/%s/%s --no-refresh -v in %s" % (re.sub(':',':/',args[0]), 'openSUSE_11.4', args[1]) cmd = "sudo zypper -p http://download.opensuse.org/repositories/%s/%s --no-refresh -v in %s" % (re.sub(':', ':/', args[0]), 'openSUSE_11.4', args[1])
print(self.do_install.__doc__) print(self.do_install.__doc__)
print("Example: \n" + cmd) print("Example: \n" + cmd)
@@ -3831,8 +3831,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
package = args[0] package = args[0]
rev, dummy = parseRevisionOption(opts.revision) rev, dummy = parseRevisionOption(opts.revision)
if rev==None: if rev == None:
rev="latest" rev = "latest"
if rev and rev != "latest" and not checkRevision(project, package, rev): if rev and rev != "latest" and not checkRevision(project, package, rev):
print('Revision \'%s\' does not exist' % rev, file=sys.stderr) print('Revision \'%s\' does not exist' % rev, file=sys.stderr)
@@ -4652,7 +4652,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
repository = args[0] repository = args[0]
arch = args[1] arch = args[1]
offset=0 offset = 0
if subcmd == "blt" or subcmd == "buildlogtail": if subcmd == "blt" or subcmd == "buildlogtail":
query = { 'view': 'entry' } query = { 'view': 'entry' }
u = makeurl(self.get_api_url(), ['build', project, repository, arch, package, '_log'], query=query) u = makeurl(self.get_api_url(), ['build', project, repository, arch, package, '_log'], query=query)
@@ -4664,7 +4664,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
else: else:
offset = offset - ( 8 * 1024 ) offset = offset - ( 8 * 1024 )
if offset < 0: if offset < 0:
offset=0 offset = 0
elif opts.offset: elif opts.offset:
offset = int(opts.offset) offset = int(opts.offset)
strip_time = opts.strip_time or conf.config['buildlog_strip_time'] strip_time = opts.strip_time or conf.config['buildlog_strip_time']
@@ -4727,7 +4727,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
else: else:
project, package, repository, arch = args project, package, repository, arch = args
offset=0 offset = 0
if subcmd == "rblt" or subcmd == "rbuildlogtail" or subcmd == "remotebuildlogtail": if subcmd == "rblt" or subcmd == "rbuildlogtail" or subcmd == "remotebuildlogtail":
query = { 'view': 'entry' } query = { 'view': 'entry' }
u = makeurl(self.get_api_url(), ['build', project, repository, arch, package, '_log'], query=query) u = makeurl(self.get_api_url(), ['build', project, repository, arch, package, '_log'], query=query)
@@ -4739,7 +4739,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
else: else:
offset = offset - ( 8 * 1024 ) offset = offset - ( 8 * 1024 )
if offset < 0: if offset < 0:
offset=0 offset = 0
elif opts.offset: elif opts.offset:
offset = int(opts.offset) offset = int(opts.offset)
strip_time = opts.strip_time or conf.config['buildlog_strip_time'] strip_time = opts.strip_time or conf.config['buildlog_strip_time']
@@ -4941,7 +4941,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
@cmdln.option('-d', '--debug', action='store_true', @cmdln.option('-d', '--debug', action='store_true',
help='verbose output of build dependencies') help='verbose output of build dependencies')
@cmdln.option('-x', '--extra-pkgs', metavar='PAC', action='append', @cmdln.option('-x', '--extra-pkgs', metavar='PAC', action='append',
help='Add this package when computing the buildinfo') help='Add this package when computing the buildinfo')
@cmdln.option('-p', '--prefer-pkgs', metavar='DIR', action='append', @cmdln.option('-p', '--prefer-pkgs', metavar='DIR', action='append',
@@ -6196,9 +6196,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
user = opts.user user = opts.user
what = {'project': '', 'package': ''} what = {'project': '', 'package': ''}
type="work" type = "work"
if len(args) > 0: if len(args) > 0:
type=args[0] type = args[0]
list_patchinfos = list_requests = False list_patchinfos = list_requests = False
if type in args_patchinfos: if type in args_patchinfos:
@@ -6430,7 +6430,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
# XXX: is it a good idea to make this the default? # XXX: is it a good idea to make this the default?
# support perl symbols: # support perl symbols:
if re.match('^perl\(\w+(::\w+)*\)$', search_term): if re.match('^perl\(\w+(::\w+)*\)$', search_term):
search_term = re.sub('\)','', re.sub('(::|\()','-', search_term)) search_term = re.sub('\)', '', re.sub('(::|\()', '-', search_term))
opts.package = True opts.package = True
if opts.mine: if opts.mine:
@@ -6533,7 +6533,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
result.append(package) result.append(package)
if opts.version and package != None: if opts.version and package != None:
sr = get_source_rev(apiurl,project,package) sr = get_source_rev(apiurl, project, package)
v = sr.get('version') v = sr.get('version')
r = sr.get('rev') r = sr.get('rev')
s = sr.get('srcmd5') s = sr.get('srcmd5')
@@ -6874,13 +6874,13 @@ Please submit there instead, or use --nodevelproject to force direct submission.
# Try the OBS 2.4 way first. # Try the OBS 2.4 way first.
if binary or opts.user or opts.group: if binary or opts.user or opts.group:
limit=None limit = None
if opts.all: if opts.all:
limit=0 limit = 0
filterroles=roles filterroles = roles
if filterroles == [ 'bugowner', 'maintainer' ]: if filterroles == [ 'bugowner', 'maintainer' ]:
# use server side configured default # use server side configured default
filterroles=None filterroles = None
if binary: if binary:
searchresult = owner(apiurl, binary, "binary", usefilter=filterroles, devel=None, limit=limit) searchresult = owner(apiurl, binary, "binary", usefilter=filterroles, devel=None, limit=limit)
if not searchresult and (opts.set_bugowner or opts.set_bugowner_request): if not searchresult and (opts.set_bugowner or opts.set_bugowner_request):
@@ -6937,7 +6937,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
args = [bugowner, result.get('project')] args = [bugowner, result.get('project')]
if result.get('package'): if result.get('package'):
args = args + [result.get('package')] args = args + [result.get('package')]
requestactionsxml += self._set_bugowner(args,opts) requestactionsxml += self._set_bugowner(args, opts)
else: else:
if opts.set_bugowner: if opts.set_bugowner:
@@ -6961,7 +6961,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
args = [bugowner, prj] args = [bugowner, prj]
if pac: if pac:
args = args + [pac] args = args + [pac]
requestactionsxml += self._set_bugowner(args,opts) requestactionsxml += self._set_bugowner(args, opts)
if requestactionsxml != "": if requestactionsxml != "":
if opts.message: if opts.message:
@@ -7039,11 +7039,11 @@ Please submit there instead, or use --nodevelproject to force direct submission.
# showing the maintainers # showing the maintainers
for maintainers in projects: for maintainers in projects:
indent="" indent = ""
definingproject=maintainers.get("project") definingproject=maintainers.get("project")
if definingproject: if definingproject:
definingpackage=maintainers.get("package") definingpackage=maintainers.get("package")
indent=" " indent = " "
if definingpackage: if definingpackage:
print("Defined in package: %s/%s " %(definingproject, definingpackage)) print("Defined in package: %s/%s " %(definingproject, definingpackage))
else: else: