Skip to content

Commit

Permalink
commandline.py: add missing spaces
Browse files Browse the repository at this point in the history
Add missing spaces around operators, add missing spaces after comma.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
  • Loading branch information
dalgaaf committed May 27, 2013
1 parent 439e035 commit 8403c92
Showing 1 changed file with 51 additions and 51 deletions.
102 changes: 51 additions & 51 deletions osc/commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ def do_patchinfo(self, subcmd, opts, *args):

if opts.force or not filelist or not '_patchinfo' in filelist:
print("Creating new patchinfo...")
query='cmd=createpatchinfo&name=' + patchinfo
query = 'cmd=createpatchinfo&name=' + patchinfo
if opts.force:
query += "&force=1"
url = makeurl(apiurl, ['source', project], query=query)
Expand All @@ -493,7 +493,7 @@ def do_patchinfo(self, subcmd, opts, *args):
patchinfo = p
else:
print("Update existing _patchinfo file...")
query='cmd=updatepatchinfo'
query = 'cmd=updatepatchinfo'
url = makeurl(apiurl, ['source', project, patchinfo], query=query)
f = http_POST(url)

Expand Down Expand Up @@ -918,9 +918,9 @@ def do_submitrequest(self, subcmd, opts, *args):
sr_ids = []
# for single request
actionxml = ""
options_block=""
options_block = ""
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
for p in meta_get_packagelist(apiurl, project):
Expand Down Expand Up @@ -1082,25 +1082,25 @@ def do_submitrequest(self, subcmd, opts, *args):
if not opts.diff:
sys.exit(1)

rev=opts.revision
rev = opts.revision
if not rev:
# get _link info from server, that knows about the local state ...
u = makeurl(apiurl, ['source', src_project, src_package], query="expand=1")
f = http_GET(u)
root = ET.parse(f).getroot()
linkinfo = root.find('linkinfo')
if linkinfo == None:
rev=root.get('rev')
rev = root.get('rev')
else:
if linkinfo.get('project') != dst_project or linkinfo.get('package') != dst_package:
# the submit target is not link target. use merged md5sum references to
# avoid not mergable sources when multiple request from same source get created.
rev=root.get('srcmd5')
rev = root.get('srcmd5')

rdiff = None
if opts.diff or not opts.message:
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,
dst_project, dst_package, None,
src_project, src_package, rev, True)
Expand Down Expand Up @@ -1169,7 +1169,7 @@ def _actionparser(self, opt_str, value, parser):
parser.values.actiondata.append(value)

def _submit_request(self, args, opts, options_block):
actionxml=""
actionxml = ""
apiurl = self.get_api_url()
if len(args) == 0 and is_project_dir(os.getcwd()):
# submit requests for multiple packages are currently handled via multiple requests
Expand Down Expand Up @@ -1207,7 +1207,7 @@ def _submit_request(self, args, opts, options_block):
if rdiff != '':
targetprojects.append(t)
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:
print("Skipping package ", p, " since it has no difference with the target package.")
else:
Expand Down Expand Up @@ -1297,7 +1297,7 @@ def _submit_request(self, args, opts, options_block):
rdiff = None
if opts.diff:
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,
dst_project, dst_package, opts.revision,
src_project, src_package, None, True)
Expand Down Expand Up @@ -1514,9 +1514,9 @@ def do_createrequest(self, subcmd, opts, *args):
elif opts.no_update:
src_update = "noupdate"

options_block=""
options_block = ""
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)

Expand All @@ -1528,30 +1528,30 @@ def do_createrequest(self, subcmd, opts, *args):
if ai == 'submit':
args = opts.actiondata[i]
i = i+1
actionsxml += self._submit_request(args,opts, options_block)
actionsxml += self._submit_request(args, opts, options_block)
elif ai == 'delete':
args = opts.actiondata[i]
actionsxml += self._delete_request(args,opts)
actionsxml += self._delete_request(args, opts)
i = i+1
elif ai == 'change_devel':
args = opts.actiondata[i]
actionsxml += self._changedevel_request(args,opts)
actionsxml += self._changedevel_request(args, opts)
i = i+1
elif ai == 'add_me':
args = opts.actiondata[i]
actionsxml += self._add_me(args,opts)
actionsxml += self._add_me(args, opts)
i = i+1
elif ai == 'add_group':
args = opts.actiondata[i]
actionsxml += self._add_group(args,opts)
actionsxml += self._add_group(args, opts)
i = i+1
elif ai == 'add_role':
args = opts.actiondata[i]
actionsxml += self._add_user(args,opts)
actionsxml += self._add_user(args, opts)
i = i+1
elif ai == 'set_bugowner':
args = opts.actiondata[i]
actionsxml += self._set_bugowner(args,opts)
actionsxml += self._set_bugowner(args, opts)
i = i+1
else:
raise oscerr.WrongArgs('Unsupported action %s' % ai)
Expand Down Expand Up @@ -1682,12 +1682,12 @@ def do_deleterequest(self, subcmd, opts, *args):
if not opts.message:
import textwrap
if package is not None:
footer=textwrap.TextWrapper(width = 66).fill(
'please explain why you like to delete package %s of project %s'
% (package,project))
footer = textwrap.TextWrapper(width = 66).fill(
'please explain why you like to delete package %s of project %s'
% (package,project))
else:
footer=textwrap.TextWrapper(width = 66).fill(
'please explain why you like to delete project %s' % project)
footer = textwrap.TextWrapper(width = 66).fill(
'please explain why you like to delete project %s' % project)
opts.message = edit_message(footer)

r = Request()
Expand Down Expand Up @@ -1732,9 +1732,9 @@ def do_changedevelrequest(self, subcmd, opts, *args):

if not opts.message:
import textwrap
footer=textwrap.TextWrapper(width = 66).fill(
'please explain why you like to change the devel project of %s/%s to %s/%s'
% (project,package,devel_project,devel_package))
footer = textwrap.TextWrapper(width = 66).fill(
'please explain why you like to change the devel project of %s/%s to %s/%s'
% (project,package,devel_project,devel_package))
opts.message = edit_message(footer)

r = Request()
Expand Down Expand Up @@ -2032,7 +2032,7 @@ def do_request(self, subcmd, opts, *args):
except ValueError:
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
## bs has received 2009-09-20 a new xquery compare() function
Expand Down Expand Up @@ -2158,7 +2158,7 @@ def do_request(self, subcmd, opts, *args):
rq = get_request(apiurl, reqid)
if opts.or_revoke:
if rq.state.name == "declined":
cmd="revoke"
cmd = "revoke"
elif rq.state.name != "new" and rq.state.name != "review":
return 0
if rq.state.name == state_map[cmd]:
Expand Down Expand Up @@ -2213,7 +2213,7 @@ def do_request(self, subcmd, opts, *args):
print('Cannot get list of files for %s/%s: %s' % (project, package, e), file=sys.stderr)
except SyntaxError as e:
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
continue

Expand Down Expand Up @@ -3706,7 +3706,7 @@ def do_install(self, subcmd, opts, *args):
##
## 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("Example: \n" + cmd)

Expand Down Expand Up @@ -3831,8 +3831,8 @@ def do_checkout(self, subcmd, opts, *args):
package = args[0]

rev, dummy = parseRevisionOption(opts.revision)
if rev==None:
rev="latest"
if rev == None:
rev = "latest"

if rev and rev != "latest" and not checkRevision(project, package, rev):
print('Revision \'%s\' does not exist' % rev, file=sys.stderr)
Expand Down Expand Up @@ -4652,7 +4652,7 @@ def do_buildlog(self, subcmd, opts, *args):
repository = args[0]
arch = args[1]

offset=0
offset = 0
if subcmd == "blt" or subcmd == "buildlogtail":
query = { 'view': 'entry' }
u = makeurl(self.get_api_url(), ['build', project, repository, arch, package, '_log'], query=query)
Expand All @@ -4664,7 +4664,7 @@ def do_buildlog(self, subcmd, opts, *args):
else:
offset = offset - ( 8 * 1024 )
if offset < 0:
offset=0
offset = 0
elif opts.offset:
offset = int(opts.offset)
strip_time = opts.strip_time or conf.config['buildlog_strip_time']
Expand Down Expand Up @@ -4727,7 +4727,7 @@ def do_remotebuildlog(self, subcmd, opts, *args):
else:
project, package, repository, arch = args

offset=0
offset = 0
if subcmd == "rblt" or subcmd == "rbuildlogtail" or subcmd == "remotebuildlogtail":
query = { 'view': 'entry' }
u = makeurl(self.get_api_url(), ['build', project, repository, arch, package, '_log'], query=query)
Expand All @@ -4739,7 +4739,7 @@ def do_remotebuildlog(self, subcmd, opts, *args):
else:
offset = offset - ( 8 * 1024 )
if offset < 0:
offset=0
offset = 0
elif opts.offset:
offset = int(opts.offset)
strip_time = opts.strip_time or conf.config['buildlog_strip_time']
Expand Down Expand Up @@ -4941,7 +4941,7 @@ def do_dependson(self, subcmd, opts, *args):


@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',
help='Add this package when computing the buildinfo')
@cmdln.option('-p', '--prefer-pkgs', metavar='DIR', action='append',
Expand Down Expand Up @@ -6196,9 +6196,9 @@ def do_my(self, subcmd, opts, *args):
user = opts.user

what = {'project': '', 'package': ''}
type="work"
type = "work"
if len(args) > 0:
type=args[0]
type = args[0]

list_patchinfos = list_requests = False
if type in args_patchinfos:
Expand Down Expand Up @@ -6430,7 +6430,7 @@ def build_xpath(attr, what, substr = False):
# XXX: is it a good idea to make this the default?
# support perl symbols:
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

if opts.mine:
Expand Down Expand Up @@ -6533,7 +6533,7 @@ def build_xpath(attr, what, substr = False):
result.append(package)

if opts.version and package != None:
sr = get_source_rev(apiurl,project,package)
sr = get_source_rev(apiurl, project, package)
v = sr.get('version')
r = sr.get('rev')
s = sr.get('srcmd5')
Expand Down Expand Up @@ -6874,13 +6874,13 @@ def do_maintainer(self, subcmd, opts, *args):

# Try the OBS 2.4 way first.
if binary or opts.user or opts.group:
limit=None
limit = None
if opts.all:
limit=0
filterroles=roles
limit = 0
filterroles = roles
if filterroles == [ 'bugowner', 'maintainer' ]:
# use server side configured default
filterroles=None
filterroles = None
if binary:
searchresult = owner(apiurl, binary, "binary", usefilter=filterroles, devel=None, limit=limit)
if not searchresult and (opts.set_bugowner or opts.set_bugowner_request):
Expand Down Expand Up @@ -6937,7 +6937,7 @@ def do_maintainer(self, subcmd, opts, *args):
args = [bugowner, result.get('project')]
if result.get('package'):
args = args + [result.get('package')]
requestactionsxml += self._set_bugowner(args,opts)
requestactionsxml += self._set_bugowner(args, opts)

else:
if opts.set_bugowner:
Expand All @@ -6961,7 +6961,7 @@ def do_maintainer(self, subcmd, opts, *args):
args = [bugowner, prj]
if pac:
args = args + [pac]
requestactionsxml += self._set_bugowner(args,opts)
requestactionsxml += self._set_bugowner(args, opts)

if requestactionsxml != "":
if opts.message:
Expand Down Expand Up @@ -7039,11 +7039,11 @@ def do_maintainer(self, subcmd, opts, *args):

# showing the maintainers
for maintainers in projects:
indent=""
indent = ""
definingproject=maintainers.get("project")
if definingproject:
definingpackage=maintainers.get("package")
indent=" "
indent = " "
if definingpackage:
print("Defined in package: %s/%s " %(definingproject, definingpackage))
else:
Expand Down

0 comments on commit 8403c92

Please sign in to comment.