1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-09-20 01:06:17 +02:00

Resolve PEP8 issue W291

* W291 trailing whitespace
This commit is contained in:
Christian Berendt 2014-08-12 15:01:16 +02:00
parent 902adde28b
commit d35983d5b8
8 changed files with 73 additions and 73 deletions

View File

@ -63,7 +63,7 @@ can_also_build = {
'armv7hl':[ 'armv7hl' ], # not existing arch, just for compatibility
'armv8el':[ 'armv4l', 'armv5el', 'armv6el', 'armv7el', 'armv8el' ], # not existing arch, just for compatibility
'armv8l' :[ 'armv4l', 'armv5el', 'armv6el', 'armv7el', 'armv8el' ], # not existing arch, just for compatibility
'armv5tel':[ 'armv4l', 'armv5el', 'armv5tel' ],
'armv5tel':[ 'armv4l', 'armv5el', 'armv5tel' ],
's390x': ['s390' ],
'ppc64': [ 'ppc', 'ppc64', 'ppc64p7', 'ppc64le' ],
'ppc64le':[ 'ppc64le' ],
@ -640,8 +640,8 @@ def main(apiurl, opts, argv):
pkg_meta_e = None
try:
# take care, not to run into double trouble.
pkg_meta_e = meta_exists(metatype='pkg', path_args=(quote_plus(prj),
quote_plus(pac)), template_args=None, create_new=False,
pkg_meta_e = meta_exists(metatype='pkg', path_args=(quote_plus(prj),
quote_plus(pac)), template_args=None, create_new=False,
apiurl=apiurl)
except:
pass

View File

@ -90,7 +90,7 @@ class Checker:
def check(self, pkg):
# avoid errors on non rpm
if pkg[-4:] != '.rpm':
if pkg[-4:] != '.rpm':
return
fd = None
try:

View File

@ -516,7 +516,7 @@ class RawCmdln(cmd.Cmd):
elif line[0] == '?':
line = 'help ' + line[1:]
i, n = 0, len(line)
while i < n and line[i] in self.identchars:
while i < n and line[i] in self.identchars:
i = i+1
cmd, arg = line[:i], line[i:].strip()
return cmd, arg, line
@ -574,7 +574,7 @@ class RawCmdln(cmd.Cmd):
doc = self.__class__.__doc__ # try class docstring
if doc is None:
# Try to provide some reasonable useful default help.
if self.cmdlooping:
if self.cmdlooping:
prefix = ""
else:
prefix = self.name+' '
@ -739,7 +739,7 @@ class RawCmdln(cmd.Cmd):
token2canonical = self._get_canonical_map()
aliases = {}
for token, cmdname in token2canonical.items():
if token == cmdname:
if token == cmdname:
continue
aliases.setdefault(cmdname, []).append(token)
@ -803,7 +803,7 @@ class RawCmdln(cmd.Cmd):
helpnames = {}
token2cmdname = self._get_canonical_map()
for attr in self.get_names():
if not attr.startswith("help_"):
if not attr.startswith("help_"):
continue
helpname = attr[5:]
if helpname not in token2cmdname:
@ -854,9 +854,9 @@ class RawCmdln(cmd.Cmd):
# Adjust argcount for possible *args and **kwargs arguments.
argcount = co_argcount
if co_flags & CO_FLAGS_ARGS:
if co_flags & CO_FLAGS_ARGS:
argcount += 1
if co_flags & CO_FLAGS_KWARGS:
if co_flags & CO_FLAGS_KWARGS:
argcount += 1
# Determine the usage string.
@ -937,9 +937,9 @@ class RawCmdln(cmd.Cmd):
token2canonical = {}
cmd2funcname = {} # use a dict to strip duplicates
for attr in self.get_names():
if attr.startswith("do_"):
if attr.startswith("do_"):
cmdname = attr[3:]
elif attr.startswith("_do_"):
elif attr.startswith("_do_"):
cmdname = attr[4:]
else:
continue
@ -1371,12 +1371,12 @@ def line2argv(line):
i = -1
while True:
i += 1
if i >= len(line):
if i >= len(line):
break
ch = line[i]
if ch == "\\": # escaped char always added to arg, regardless of state
if arg is None:
if arg is None:
arg = ""
i += 1
arg += line[i]
@ -1394,11 +1394,11 @@ def line2argv(line):
arg += ch
elif state == "default":
if ch == '"':
if arg is None:
if arg is None:
arg = ""
state = "double-quoted"
elif ch == "'":
if arg is None:
if arg is None:
arg = ""
state = "single-quoted"
elif ch in string.whitespace:
@ -1406,7 +1406,7 @@ def line2argv(line):
argv.append(arg)
arg = None
else:
if arg is None:
if arg is None:
arg = ""
arg += ch
if arg is not None:
@ -1485,7 +1485,7 @@ def _dedentlines(lines, tabsize=8, skip_first_line=False):
break
else:
continue # skip all-whitespace lines
if DEBUG:
if DEBUG:
print("dedent: indent=%d: %r" % (indent, line))
if margin is None:
margin = indent
@ -1496,7 +1496,7 @@ def _dedentlines(lines, tabsize=8, skip_first_line=False):
if margin is not None and margin > 0:
for i, line in enumerate(lines):
if i == 0 and skip_first_line:
if i == 0 and skip_first_line:
continue
removed = 0
for j, ch in enumerate(line):
@ -1505,7 +1505,7 @@ def _dedentlines(lines, tabsize=8, skip_first_line=False):
elif ch == '\t':
removed += tabsize - (removed % tabsize)
elif ch in '\r\n':
if DEBUG:
if DEBUG:
print("dedent: %r: EOL -> strip up to EOL" % line)
lines[i] = lines[i][j:]
break

View File

@ -150,7 +150,7 @@ class Osc(cmdln.Cmdln):
conf.write_initial_config(e.file, config)
print('done', file=sys.stderr)
if try_again:
if try_again:
self.postoptparse(try_again = False)
except oscerr.ConfigMissingApiurl as e:
print(e.msg, file=sys.stderr)
@ -158,7 +158,7 @@ class Osc(cmdln.Cmdln):
user = raw_input('Username: ')
passwd = getpass.getpass()
conf.add_section(e.file, e.url, user, passwd)
if try_again:
if try_again:
self.postoptparse(try_again = False)
self.options.verbose = conf.config['verbose']
@ -182,7 +182,7 @@ class Osc(cmdln.Cmdln):
## check for Stale NFS file handle: '.'
try:
os.stat('.')
except Exception as ee:
except Exception as ee:
e = ee
print("os.getcwd() failed: ", e, file=sys.stderr)
sys.exit(1)
@ -304,7 +304,7 @@ class Osc(cmdln.Cmdln):
pass
if len(args) > 0:
project = args[0]
if project == '/':
if project == '/':
project = None
if project == '.':
cwd = os.getcwd()
@ -340,7 +340,7 @@ class Osc(cmdln.Cmdln):
if opts.binaries and opts.expand:
raise oscerr.WrongOptions('Sorry, --binaries and --expand are mutual exclusive.')
apiurl = self.get_api_url()
apiurl = self.get_api_url()
# list binaries
if opts.binaries:
@ -428,7 +428,7 @@ class Osc(cmdln.Cmdln):
print_not_found = False
else:
print('\n'.join(l))
if opts.expand or opts.unexpand or not link_seen:
if opts.expand or opts.unexpand or not link_seen:
break
m = show_files_meta(apiurl, project, package)
li = Linkinfo()
@ -461,7 +461,7 @@ class Osc(cmdln.Cmdln):
${cmd_option_list}
"""
apiurl = self.get_api_url()
apiurl = self.get_api_url()
project_dir = localdir = os.getcwd()
patchinfo = 'patchinfo'
if len(args) == 0:
@ -509,7 +509,7 @@ class Osc(cmdln.Cmdln):
f = http_POST(url)
# CAUTION:
# Both conf.config['checkout_no_colon'] and conf.config['checkout_rooted']
# Both conf.config['checkout_no_colon'] and conf.config['checkout_rooted']
# fool this test:
if is_package_dir(localdir):
pac = Package(localdir)
@ -794,7 +794,7 @@ class Osc(cmdln.Cmdln):
elif cmd == 'pkg':
sys.stdout.write(''.join(show_package_meta(apiurl, project, package)))
elif cmd == 'attribute':
sys.stdout.write(''.join(show_attribute_meta(apiurl, project, package, subpackage,
sys.stdout.write(''.join(show_attribute_meta(apiurl, project, package, subpackage,
opts.attribute, opts.attribute_defaults, opts.attribute_project)))
elif cmd == 'prjconf':
sys.stdout.write(''.join(show_project_conf(apiurl, project)))
@ -1202,7 +1202,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
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
# 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')
@ -1603,10 +1603,10 @@ Please submit there instead, or use --nodevelproject to force direct submission.
"""${cmd_name}: create multiple requests with a single command
usage:
osc creq [OPTIONS] [
-a submit SOURCEPRJ SOURCEPKG DESTPRJ [DESTPKG]
-a delete PROJECT [PACKAGE]
-a change_devel PROJECT PACKAGE DEVEL_PROJECT [DEVEL_PACKAGE]
osc creq [OPTIONS] [
-a submit SOURCEPRJ SOURCEPKG DESTPRJ [DESTPKG]
-a delete PROJECT [PACKAGE]
-a change_devel PROJECT PACKAGE DEVEL_PROJECT [DEVEL_PACKAGE]
-a add_me ROLE PROJECT [PACKAGE]
-a add_group GROUP ROLE PROJECT [PACKAGE]
-a add_role USER ROLE PROJECT [PACKAGE]
@ -1705,7 +1705,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
osc requestmaintainership PROJECT PACKAGE # for current user
osc requestmaintainership PROJECT PACKAGE USER # request for specified user
osc requestbugownership ... # accepts same parameters but uses bugowner role
osc requestbugownership ... # accepts same parameters but uses bugowner role
${cmd_option_list}
"""
@ -1795,7 +1795,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
elif is_package_dir(os.getcwd()):
project = store_read_project(os.curdir)
package = store_read_package(os.curdir)
else:
else:
raise oscerr.WrongArgs('Please specify at least a project.')
if opts.repository:
@ -1828,7 +1828,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
def do_changedevelrequest(self, subcmd, opts, *args):
"""${cmd_name}: Create request to change the devel package definition.
[See http://en.opensuse.org/openSUSE:Build_Service_Collaboration
[See http://en.opensuse.org/openSUSE:Build_Service_Collaboration
for information on this topic.]
See the "request" command for showing and modifing existing requests.
@ -1954,7 +1954,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
The 'review' command has the following sub commands:
"list" lists open requests that need to be reviewed by the
specified user or group
specified user or group
"add" adds a person or group as reviewer to a request
@ -2755,7 +2755,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
@cmdln.option('--set-release', metavar='RELEASETAG',
help='rename binaries during release using this release tag')
def do_release(self, subcmd, opts, *args):
"""${cmd_name}: Release sources and binaries
"""${cmd_name}: Release sources and binaries
This command is used to transfer sources and binaries without rebuilding them.
It requires defined release targets set to trigger="manual". Please refer the
@ -3129,7 +3129,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
${cmd_option_list}
"""
if subcmd == 'getpac' or subcmd == 'branchco' or subcmd == 'bco':
if subcmd == 'getpac' or subcmd == 'branchco' or subcmd == 'bco':
opts.checkout = True
args = slash_split(args)
tproject = tpackage = None
@ -3288,7 +3288,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
## FIXME: core.py:commitDelPackage() should have something similar
rlist = get_request_list(apiurl, prj, pkg)
for rq in rlist:
for rq in rlist:
print(rq)
if len(rlist) >= 1 and not opts.force:
print('Package has pending requests. Deleting the package will break them. '\
@ -3423,11 +3423,11 @@ Please submit there instead, or use --nodevelproject to force direct submission.
Default: all files.
osc diff --link
osc linkdiff
osc linkdiff
Compare current checkout directory against the link base.
osc diff --link PROJ PACK
osc linkdiff PROJ PACK
osc diff --link PROJ PACK
osc linkdiff PROJ PACK
Compare a package against the link base (ignoring working copy changes).
${cmd_option_list}
@ -3728,7 +3728,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
return 1
if not noparentok and not self._pdiff_package_exists(apiurl, parent_project, parent_package):
self._pdiff_raise_non_existing_package(parent_project, parent_package,
self._pdiff_raise_non_existing_package(parent_project, parent_package,
msg = 'Parent for %s/%s (%s/%s) does not exist.' % \
(project, package, parent_project, parent_package))
@ -3893,7 +3893,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
def do_install(self, subcmd, opts, *args):
"""${cmd_name}: install a package after build via zypper in -r
Not implemented here. Please try
Not implemented here. Please try
http://software.opensuse.org/search?q=osc-plugin-install&include_home=true
@ -3995,7 +3995,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
osc co PACKAGE # check out PACKAGE from project
with the result of rpm -q --qf '%%{DISTURL}\\n' PACKAGE
osc co obs://API/PROJECT/PLATFORM/REVISION-PACKAGE
osc co obs://API/PROJECT/PLATFORM/REVISION-PACKAGE
${cmd_option_list}
"""
@ -4010,7 +4010,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
+ self.get_cmd_help('checkout'))
# XXX: this too openSUSE-setup specific...
# FIXME: this should go into ~jw/patches/osc/osc.proj_pack_20101201.diff
# FIXME: this should go into ~jw/patches/osc/osc.proj_pack_20101201.diff
# to be available to all subcommands via @cmdline.prep(proj_pack)
# obs://build.opensuse.org/openSUSE:11.3/standard/fc6c25e795a89503e99d59da5dc94a79-screen
m = re.match(r"obs://([^/]+)/(\S+)/([^/]+)/([A-Fa-f\d]+)\-(\S+)", args[0])
@ -4641,10 +4641,10 @@ Please submit there instead, or use --nodevelproject to force direct submission.
"""${cmd_name}: Shows all available distributions
This command shows the available distributions. For active distributions
it shows the name, project and name of the repository and a suggested default repository name.
it shows the name, project and name of the repository and a suggested default repository name.
usage:
osc distributions
osc distributions
${cmd_option_list}
"""
@ -5281,7 +5281,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
which is directly readable by the build script. It contains RPM macros
and BuildRequires expansions, for example.
The argument REPOSITORY an be taken from the first column of the
The argument REPOSITORY an be taken from the first column of the
'osc repos' output.
usage:
@ -5353,7 +5353,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
disabled = show_package_disabled_repos(apiurl, project, package)
if subcmd == 'repos_only':
for repo in get_repositories_of_project(apiurl, project):
for repo in get_repositories_of_project(apiurl, project):
if (disabled is None) or ((disabled is not None) and (repo not in disabled)):
print(repo)
else:
@ -5661,7 +5661,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
# drop the --argument, value tuple from the list
def drop_arg2(lst, name):
if not name:
if not name:
return lst
while name in lst:
i = lst.index(name)
@ -5756,7 +5756,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
return ret
for arg, long_name in ((opts.rsyncsrc, '--rsync-src'), (opts.overlay, '--overlay')):
if not arg:
if not arg:
continue
ret = rsync_dirs_2host(hostargs, None, long_name, (arg, ))
if ret != 0:
@ -6019,7 +6019,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
osc service remoterun [PROJECT PACKAGE]
COMMAND can be:
run r run defined services locally, it takes an optional parameter to run only a
run r run defined services locally, it takes an optional parameter to run only a
specified source service. In case parameters exist for this one in _service file
they are used.
disabledrun dr run disabled or server side only services locally and store files as local created
@ -6337,7 +6337,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if package is None:
package = meta_get_packagelist(apiurl, project)
else:
else:
package = [package]
# Set binary target directory and create if not existing
@ -6420,7 +6420,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
"""
# TODO: please clarify the difference between sr and rq.
# My first implementeation was to make no difference between requests FROM one
# My first implementeation was to make no difference between requests FROM one
# of my projects and TO one of my projects. The current implementation appears to make this difference.
# The usage above indicates, that sr would be a subset of rq, which is no the case with my tests.
# jw.
@ -6627,7 +6627,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
help='match only when given attribute exists in meta data')
@cmdln.option('-v', '--verbose', action='store_true',
help='show more information')
@cmdln.option('-V', '--version', action='store_true',
@cmdln.option('-V', '--version', action='store_true',
help='show package version, revision, and srcmd5. CAUTION: This is slow and unreliable')
@cmdln.option('-i', '--involved', action='store_true',
help='show projects/packages where given person (or myself) is involved as bugowner or maintainer')
@ -6820,7 +6820,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
continue
# construct a sorted, flat list
# Sort by first column, follwed by second column if we have two columns, else sort by first.
results.sort(lambda x, y: ( cmp(x[0], y[0]) or
results.sort(lambda x, y: ( cmp(x[0], y[0]) or
(len(x)>1 and len(y)>1 and cmp(x[1], y[1])) ))
new = []
for i in results:
@ -7154,7 +7154,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
apiurl = self.get_api_url()
# Try the OBS 2.4 way first.
# Try the OBS 2.4 way first.
if binary or opts.user or opts.group:
limit = None
if opts.all:
@ -7307,7 +7307,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
else:
print("Defined in project: ", definingproject)
if prj:
if prj:
# not for user/group search
for role in roles:
if opts.bugowner and not len(maintainers.get(role, [])):

View File

@ -407,7 +407,7 @@ class Serviceinfo:
if r != 0:
print("Aborting: service call failed: " + cmd)
# FIXME: addDownloadUrlService calls si.execute after
# FIXME: addDownloadUrlService calls si.execute after
# updating _services.
return r
@ -871,7 +871,7 @@ class Project:
if needs_update:
rev = p.latest_rev()
elif p.hasserviceinfo() and p.serviceinfo.isexpanded() and not service_files:
# FIXME: currently, do_update does not propagate the --server-side-source-service-files
# FIXME: currently, do_update does not propagate the --server-side-source-service-files
# option to this method. Consequence: an expanded service is always unexpanded during
# an update (TODO: discuss if this is a reasonable behavior (at least this the default
# behavior for a while))
@ -2109,7 +2109,7 @@ rev: %s
# this false-positives (patch was already sent to the ml) (but this also
# requires some slight changes in osc)
return sinfo.get('srcmd5') != self.srcmd5
elif self.hasserviceinfo():
elif self.hasserviceinfo():
# check if we have expanded or unexpanded services
if self.serviceinfo.isexpanded():
return sinfo.get('lsrcmd5') != self.srcmd5
@ -2792,7 +2792,7 @@ class Request:
if review.by_group:
d['by'] = "Group: " + review.by_group
if review.by_package:
d['by'] = "Package: " + review.by_project + "/" + review.by_package
d['by'] = "Package: " + review.by_project + "/" + review.by_package
elif review.by_project:
d['by'] = "Project: " + review.by_project
d['when'] = review.when or ''
@ -3968,7 +3968,7 @@ def change_request_state_template(req, newstate):
action = req.actions[0]
tmpl_name = '%srequest_%s_template' % (action.type, newstate)
tmpl = conf.config.get(tmpl_name, '')
tmpl = tmpl.replace('\\t', '\t').replace('\\n', '\n')
tmpl = tmpl.replace('\\t', '\t').replace('\\n', '\n')
data = {'reqid': req.reqid, 'type': action.type, 'who': req.get_creator()}
if req.actions[0].type == 'submit':
data.update({'src_project': action.src_project,
@ -4554,13 +4554,13 @@ def checkout_package(apiurl, project, package,
# if we are in a package dir, goto parent.
# Hmm, with 'checkout_no_colon' in effect, we have directory levels that
# do not easily reveal the fact, that they are part of a project path.
# At least this test should find that the parent of 'home/username/branches'
# At least this test should find that the parent of 'home/username/branches'
# is a project (hack alert). Also goto parent in this case.
root_dots = "../"
elif is_project_dir("../.."):
# testing two levels is better than one.
# May happen in case of checkout_no_colon, or
# if project roots were previously inconsistent
# May happen in case of checkout_no_colon, or
# if project roots were previously inconsistent
root_dots = "../../"
if is_project_dir(root_dots):
if conf.config['checkout_no_colon']:
@ -6965,7 +6965,7 @@ def find_default_project(apiurl=None, package=None):
# any fast query will do here.
show_package_meta(apiurl, prj, package)
return prj
except HTTPError:
except HTTPError:
pass
return None

View File

@ -271,7 +271,7 @@ class myProxyHTTPSConnection(M2Crypto.httpslib.ProxyHTTPSConnection, HTTPSConnec
def endheaders(self, *args, **kwargs):
if self._proxy_auth is None:
self._proxy_auth = self._encode_auth()
HTTPSConnection.endheaders(self, *args, **kwargs)
HTTPSConnection.endheaders(self, *args, **kwargs)
# broken in m2crypto: port needs to be an int
def putrequest(self, method, url, skip_host=0, skip_accept_encoding=0):

View File

@ -295,7 +295,7 @@ class TestCommit(OscTestCase):
file='testSimple_missingfilelist', expfile='testSimple_lfilelist')
@PUT('http://localhost/source/osctest/simple/nochange?rev=repository',
exp='This file didn\'t change but\nis modified.\n', text=rev_dummy)
@POST('http://localhost/source/osctest/simple?comment=&cmd=commitfilelist&user=Admin',
@POST('http://localhost/source/osctest/simple?comment=&cmd=commitfilelist&user=Admin',
expfile='testSimple_lfilelist', text='an error occured', code=500)
def test_commitfilelist_error(self):
"""commit modified file but when committing the filelist the server returns status 500 (see ticket #65)"""

View File

@ -70,7 +70,7 @@ class TestUpdate(OscTestCase):
@GET('http://localhost/source/osctest/conflict/_meta', file='meta.xml')
def testUpdateConflict(self):
"""
a file was modified in the remote package (local file is also modified
a file was modified in the remote package (local file is also modified
and a merge isn't possible)
"""
self._change_to_pkg('conflict')