1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-12 23:56:13 +01:00

Whitespace fixes as expected by pycodestyle/pep8

This commit is contained in:
Dirk Müller 2022-04-20 19:22:35 +02:00
parent 5d7bd22340
commit 3ed913c007
No known key found for this signature in database
5 changed files with 175 additions and 175 deletions

View File

@ -10,8 +10,8 @@ import os
from osc import commandline, babysitter
try:
# this is a hack to make osc work as expected with utf-8 characters,
# no matter how site.py is set...
# this is a hack to make osc work as expected with utf-8 characters,
# no matter how site.py is set...
reload(sys)
loc = locale.getpreferredencoding()
if not loc:

View File

@ -237,8 +237,8 @@ class Pac:
]:
self.mp[i] = node.get(i)
self.mp['buildarch'] = buildarch
self.mp['pacsuffix'] = pacsuffix
self.mp['buildarch'] = buildarch
self.mp['pacsuffix'] = pacsuffix
self.mp['arch'] = node.get('arch') or self.mp['buildarch']
self.mp['name'] = node.get('name') or self.mp['binary']
@ -631,7 +631,7 @@ def main(apiurl, opts, argv):
build_descr = argv[2]
xp = []
build_root = None
cache_dir = None
cache_dir = None
build_uid = ''
build_shell_after_fail = config['build-shell-after-fail']
vm_memory = config['build-memory']
@ -918,7 +918,7 @@ def main(apiurl, opts, argv):
# special handling for overlay and rsync-src/dest
specialcmdopts = []
if opts.rsyncsrc or opts.rsyncdest :
if opts.rsyncsrc or opts.rsyncdest:
if not opts.rsyncsrc or not opts.rsyncdest:
raise oscerr.WrongOptions('When using --rsync-{src,dest} both parameters have to be specified.')
myrsyncsrc = os.path.abspath(os.path.expanduser(os.path.expandvars(opts.rsyncsrc)))
@ -1099,11 +1099,11 @@ def main(apiurl, opts, argv):
imagesource = ''
imagebins = []
if build_as_user():
# preinstallimage extraction will fail
bi.preinstallimage = None
# preinstallimage extraction will fail
bi.preinstallimage = None
if build_type == 'preinstallimage':
# preinstallimage would repackage just the previously built preinstallimage
bi.preinstallimage = None
# preinstallimage would repackage just the previously built preinstallimage
bi.preinstallimage = None
if (not config['no_preinstallimage'] and not opts.nopreinstallimage and
bi.preinstallimage and
@ -1261,62 +1261,62 @@ def main(apiurl, opts, argv):
found_obsrepositories = 0
for node in xml.findall('instrepo'):
if node and node.find('source').get('path') == 'obsrepositories:/':
for path in bi.pathes:
found_obsrepositories += 1
new_node = ET.SubElement(xml, 'instrepo')
new_node.set('name', node.get('name') + "_" + str(found_obsrepositories))
new_node.set('priority', node.get('priority'))
new_node.set('local', 'true')
new_source_node = ET.SubElement(new_node, 'source')
new_source_node.set('path', "obs://" + path)
xml.remove(node)
for path in bi.pathes:
found_obsrepositories += 1
new_node = ET.SubElement(xml, 'instrepo')
new_node.set('name', node.get('name') + "_" + str(found_obsrepositories))
new_node.set('priority', node.get('priority'))
new_node.set('local', 'true')
new_source_node = ET.SubElement(new_node, 'source')
new_source_node.set('path', "obs://" + path)
xml.remove(node)
if found_obsrepositories > 0:
build_descr = os. getcwd() + '/_service:osc_obsrepositories:' + build_descr.rsplit('/', 1)[-1]
tree.write(open(build_descr, 'wb'))
build_descr = os.getcwd() + '/_service:osc_obsrepositories:' + build_descr.rsplit('/', 1)[-1]
tree.write(open(build_descr, 'wb'))
# appliance
expand_obsrepos=None
expand_obsrepos = None
for xml in root.findall('repository'):
if xml.find('source').get('path') == 'obsrepositories:/':
expand_obsrepos=True
expand_obsrepos = True
if expand_obsrepos:
buildargs.append('--kiwi-parameter')
buildargs.append('--ignore-repos')
for xml in root.findall('repository'):
if xml.find('source').get('path') == 'obsrepositories:/':
for path in bi.pathes:
if not os.path.isdir("repos/"+path):
continue
buildargs.append('--kiwi-parameter')
buildargs.append('--add-repo')
buildargs.append('--kiwi-parameter')
buildargs.append("dir://./repos/"+path)
buildargs.append('--kiwi-parameter')
buildargs.append('--add-repotype')
buildargs.append('--kiwi-parameter')
buildargs.append('rpm-md')
if xml.get('priority'):
buildargs.append('--kiwi-parameter')
buildargs.append('--add-repoprio='+xml.get('priority'))
else:
m = re.match(r"obs://[^/]+/([^/]+)/(\S+)", xml.find('source').get('path'))
if not m:
# short path without obs instance name
m = re.match(r"obs://([^/]+)/(.+)", xml.find('source').get('path'))
project=m.group(1).replace(":", ":/")
repo=m.group(2)
buildargs.append('--kiwi-parameter')
buildargs.append('--add-repo')
buildargs.append('--kiwi-parameter')
buildargs.append("dir://./repos/"+project+"/"+repo)
buildargs.append('--kiwi-parameter')
buildargs.append('--add-repotype')
buildargs.append('--kiwi-parameter')
buildargs.append('rpm-md')
if xml.get('priority'):
buildargs.append('--kiwi-parameter')
buildargs.append('--add-repopriority='+xml.get('priority'))
buildargs.append('--kiwi-parameter')
buildargs.append('--ignore-repos')
for xml in root.findall('repository'):
if xml.find('source').get('path') == 'obsrepositories:/':
for path in bi.pathes:
if not os.path.isdir("repos/"+path):
continue
buildargs.append('--kiwi-parameter')
buildargs.append('--add-repo')
buildargs.append('--kiwi-parameter')
buildargs.append("dir://./repos/"+path)
buildargs.append('--kiwi-parameter')
buildargs.append('--add-repotype')
buildargs.append('--kiwi-parameter')
buildargs.append('rpm-md')
if xml.get('priority'):
buildargs.append('--kiwi-parameter')
buildargs.append('--add-repoprio='+xml.get('priority'))
else:
m = re.match(r"obs://[^/]+/([^/]+)/(\S+)", xml.find('source').get('path'))
if not m:
# short path without obs instance name
m = re.match(r"obs://([^/]+)/(.+)", xml.find('source').get('path'))
project = m.group(1).replace(":", ":/")
repo = m.group(2)
buildargs.append('--kiwi-parameter')
buildargs.append('--add-repo')
buildargs.append('--kiwi-parameter')
buildargs.append("dir://./repos/"+project+"/"+repo)
buildargs.append('--kiwi-parameter')
buildargs.append('--add-repotype')
buildargs.append('--kiwi-parameter')
buildargs.append('rpm-md')
if xml.get('priority'):
buildargs.append('--kiwi-parameter')
buildargs.append('--add-repopriority='+xml.get('priority'))
if vm_type == "xen" or vm_type == "kvm" or vm_type == "lxc" or vm_type == "nspawn":
print('Skipping verification of package signatures due to secure VM build')
@ -1352,8 +1352,8 @@ def main(apiurl, opts, argv):
print('Writing build configuration')
if build_type == 'kiwi' or build_type == 'docker' or build_type == 'podman'or build_type == 'fissile':
rpmlist = [ '%s %s\n' % (i.name, i.fullfilename) for i in bi.deps if not i.noinstall ]
if build_type == 'kiwi' or build_type == 'docker' or build_type == 'podman' or build_type == 'fissile':
rpmlist = ['%s %s\n' % (i.name, i.fullfilename) for i in bi.deps if not i.noinstall]
else:
rpmlist = []
for dep in bi.deps:
@ -1385,7 +1385,7 @@ def main(apiurl, opts, argv):
rpmlist_file.writelines(rpmlist)
rpmlist_file.flush()
subst = { 'repo': repo, 'arch': arch, 'project' : prj, 'package' : pacname }
subst = {'repo': repo, 'arch': arch, 'project': prj, 'package': pacname}
vm_options = []
# XXX check if build-device present
my_build_device = ''

View File

@ -126,7 +126,7 @@ class Osc(cmdln.Cmdln):
help='disable usage of GNOME Keyring')
optparser.add_option('-v', '--verbose', dest='verbose', action='count', default=0,
help='increase verbosity')
optparser.add_option('-q', '--quiet', dest='verbose', action='store_const', const=-1,
optparser.add_option('-q', '--quiet', dest='verbose', action='store_const', const=-1,
help='be quiet, not verbose')
return optparser
@ -338,7 +338,7 @@ class Osc(cmdln.Cmdln):
if opts.binaries:
if opts.repo:
if opts.repo != args[2]:
raise oscerr.WrongArgs("conflicting repos specified ('%s' vs '%s')"%(opts.repo, args[2]))
raise oscerr.WrongArgs("conflicting repos specified ('%s' vs '%s')" % (opts.repo, args[2]))
else:
opts.repo = args[2]
else:
@ -349,7 +349,7 @@ class Osc(cmdln.Cmdln):
raise oscerr.WrongArgs('Too many arguments')
if opts.arch:
if opts.arch != args[3]:
raise oscerr.WrongArgs("conflicting archs specified ('%s' vs '%s')"%(opts.arch, args[3]))
raise oscerr.WrongArgs("conflicting archs specified ('%s' vs '%s')" % (opts.arch, args[3]))
else:
opts.arch = args[3]
@ -1324,7 +1324,7 @@ class Osc(cmdln.Cmdln):
sys.exit("Please fix this first")
t = linkinfo.get('project')
if t is None:
print("Skipping package ", p, " since it is a source link pointing inside the project.")
print("Skipping package ", p, " since it is a source link pointing inside the project.")
continue
print("Submitting package ", p)
try:
@ -1343,12 +1343,12 @@ class Osc(cmdln.Cmdln):
if src_update:
options_block += """<sourceupdate>%s</sourceupdate>""" % (src_update)
if opts.update_link:
options_block + """<updatelink>true</updatelink></options> """
options_block + """<updatelink>true</updatelink></options> """
options_block += "</options>"
target_prj_block = ""
if target_project is not None:
target_prj_block = """<target project="%s"/>""" % target_project
s = """<action type="submit"> <source project="%s" /> %s %s </action>""" % \
s = """<action type="submit"> <source project="%s" /> %s %s </action>""" % \
(project, target_prj_block, options_block)
actionxml += s
xml = """<request> %s <state name="new"/> <description>%s</description> </request> """ % \
@ -1813,7 +1813,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
project = args[1]
package = ""
if len(args) > 2:
package = """package="%s" """ % (args[2])
package = """package="%s" """ % (args[2])
if user.startswith('group:'):
group = user.replace('group:', '')
@ -2013,13 +2013,13 @@ Please submit there instead, or use --nodevelproject to force direct submission.
r = Request()
if user.startswith('group:'):
group = user.replace('group:', '')
if role == 'bugowner':
r.add_action('set_bugowner', tgt_project=project, tgt_package=package,
group_name=group)
else:
r.add_action('add_role', tgt_project=project, tgt_package=package,
group_name=group, group_role=role)
group = user.replace('group:', '')
if role == 'bugowner':
r.add_action('set_bugowner', tgt_project=project, tgt_package=package,
group_name=group)
else:
r.add_action('add_role', tgt_project=project, tgt_package=package,
group_name=group, group_role=role)
elif role == 'bugowner':
r.add_action('set_bugowner', tgt_project=project, tgt_package=package,
person_name=user)
@ -2095,7 +2095,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
r.add_action('delete', tgt_project=project, tgt_package=package, tgt_repository=repository)
r.description = opts.message
if opts.accept_in_hours:
r.accept_at_in_hours(int(opts.accept_in_hours))
r.accept_at_in_hours(int(opts.accept_in_hours))
r.create(self.get_api_url())
print(r.reqid)
@ -2608,7 +2608,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
action.src_rev, expand_link=True, prj_dir=action.src_project)
else:
state_map = {'reopen' : 'new', 'accept' : 'accepted', 'decline' : 'declined', 'wipe' : 'deleted', 'revoke' : 'revoked', 'supersede' : 'superseded'}
state_map = {'reopen': 'new', 'accept': 'accepted', 'decline': 'declined', 'wipe': 'deleted', 'revoke': 'revoked', 'supersede': 'superseded'}
# Change review state only
if subcmd == 'review':
if not opts.message:
@ -2629,14 +2629,14 @@ Please submit there instead, or use --nodevelproject to force direct submission.
except HTTPError as e:
body = e.read()
if e.code in [403]:
if review.by_user:
print('No permission on review by user %s:' % review.by_user)
if review.by_group:
print('No permission on review by group %s' % review.by_group)
if review.by_package:
print('No permission on review by package %s / %s' % (review.by_project, review.by_package))
elif review.by_project:
print('No permission on review by project %s' % review.by_project)
if review.by_user:
print('No permission on review by user %s:' % review.by_user)
if review.by_group:
print('No permission on review by group %s' % review.by_group)
if review.by_package:
print('No permission on review by package %s / %s' % (review.by_project, review.by_package))
elif review.by_project:
print('No permission on review by project %s' % review.by_project)
print(e, file=sys.stderr)
else:
print('Request is closed, please reopen the request first before changing any reviews.')
@ -2684,7 +2684,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
sr_actions = rq.get_actions('submit')
for action in sr_actions:
u = makeurl(apiurl, ['/search/package'], {
'match' : "([devel[@project='%s' and @package='%s']])" % (action.tgt_project, action.tgt_package)
'match': "([devel[@project='%s' and @package='%s']])" % (action.tgt_project, action.tgt_package)
})
f = http_GET(u)
root = ET.parse(f).getroot()
@ -3137,12 +3137,12 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if len(args) == 0:
if is_package_dir(os.curdir):
source_project = store_read_project(os.curdir)
source_package = store_read_package(os.curdir)
source_project = store_read_project(os.curdir)
source_package = store_read_package(os.curdir)
elif is_project_dir(os.curdir):
source_project = store_read_project(os.curdir)
source_project = store_read_project(os.curdir)
else:
raise oscerr.WrongArgs('Too few arguments.')
raise oscerr.WrongArgs('Too few arguments.')
if len(args) > 0:
source_project = args[0]
if len(args) > 1:
@ -3511,7 +3511,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if opts.dryrun:
for r in result.findall('package'):
line="%s/%s"%(r.get('project'), r.get('package'))
line = "%s/%s" % (r.get('project'), r.get('package'))
if opts.version:
sr = get_source_rev(apiurl, r.get('project'), r.get('package'))
version = sr.get('version')
@ -3519,7 +3519,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
version = 'unknown'
line = line + (' (version: %s)' % version)
for d in r.findall('devel'):
line+=" using sources from %s/%s"%(d.get('project'), d.get('package'))
line += " using sources from %s/%s" % (d.get('project'), d.get('package'))
print(line)
return
@ -3636,7 +3636,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
opts.message = str(opts.message.encode().decode('unicode_escape'))
try:
exists, targetprj, targetpkg, srcprj, srcpkg = \
exists, targetprj, targetpkg, srcprj, srcpkg = \
branch_pkg(apiurl, args[0], args[1],
nodevelproject=opts.nodevelproject, rev=opts.revision,
linkrev=opts.linkrev,
@ -3650,9 +3650,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
missingok=opts.new_package,
maintenance=opts.maintenance)
except oscerr.NotMissing as e:
print('NOTE: Package target exists already via project links, link will point to given project.')
print(' A submission will initialize a new instance.')
exists, targetprj, targetpkg, srcprj, srcpkg = \
print('NOTE: Package target exists already via project links, link will point to given project.')
print(' A submission will initialize a new instance.')
exists, targetprj, targetpkg, srcprj, srcpkg = \
branch_pkg(apiurl, args[0], args[1],
nodevelproject=opts.nodevelproject, rev=opts.revision,
linkrev=opts.linkrev,
@ -4269,7 +4269,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
# print 'Guessed that %s/%s is the parent package.' % (parent_project, parent_package)
# New way
(exists, parent_project, parent_package) = self._pdiff_get_exists_and_parent (apiurl, project, package)
(exists, parent_project, parent_package) = self._pdiff_get_exists_and_parent(apiurl, project, package)
if not exists:
self._pdiff_raise_non_existing_package(project, package)
if not parent_project:
@ -4350,15 +4350,15 @@ Please submit there instead, or use --nodevelproject to force direct submission.
@cmdln.alias('projdiff')
@cmdln.option('-r', '--requests', action='store_true',
help='show open requests for any packages with differences')
@cmdln.option('-e', '--exclude', metavar='REGEXP', dest='exclude',
@cmdln.option('-e', '--exclude', metavar='REGEXP', dest='exclude',
help='skip packages matching REGEXP')
@cmdln.option('-i', '--include', metavar='REGEXP', dest='include',
@cmdln.option('-i', '--include', metavar='REGEXP', dest='include',
help='only consider packages matching REGEXP')
@cmdln.option('-n', '--show-not-in-old', action='store_true',
help='show packages only in the new project')
@cmdln.option('-o', '--show-not-in-new', action='store_true',
help='show packages only in the old project')
@cmdln.option('-u', '--unified', action='store_true',
@cmdln.option('-u', '--unified', action='store_true',
help='show full unified diffs of differences')
@cmdln.option('-d', '--diffstat', action='store_true',
help='show diffstat of differences')
@ -4461,7 +4461,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
"""
import tempfile
def _repo_type(apiurl, project,repo):
def _repo_type(apiurl, project, repo):
if not os.path.exists('/usr/lib/build/queryconfig'):
return None
build_config = get_buildconfig(apiurl, project, repo)
@ -4687,7 +4687,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if not os.path.exists(opts.output_dir):
os.mkdir(os.path.join(opts.output_dir))
else:
outputdir=None
outputdir = None
# don't check out local links by default
try:
@ -4984,7 +4984,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if any(pac.is_link_to_different_project() for pac in pacs):
repl = raw_input('Some of the packages are links to a different project!\n' \
'Create a local branch before commit? (y|N) ')
if repl in('y', 'Y'):
if repl in ('y', 'Y'):
can_branch = True
prj.commit(msg=msg, skip_local_service_run=skip_local_service_run, verbose=opts.verbose, can_branch=can_branch)
@ -5040,7 +5040,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if any(pac.is_link_to_different_project() for pac in pacs):
repl = raw_input('Some of the packages are links to a different project!\n' \
'Create a local branch before commit? (y|N) ')
if repl in('y', 'Y'):
if repl in ('y', 'Y'):
can_branch = True
prj_files = files[prj_path]
@ -5326,7 +5326,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
"""
apiurl = self.get_api_url()
print('\n'.join(get_distibutions(apiurl)))#FIXME:, opts.discontinued))
print('\n'.join(get_distibutions(apiurl))) # FIXME:, opts.discontinued))
@cmdln.hide(1)
def do_results_meta(self, subcmd, opts, *args):
@ -5711,7 +5711,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if project is not None:
args.append(project)
msg = 'Valid arguments are:'
doprint=True
doprint = True
if doprint:
print(msg)
@ -6332,11 +6332,11 @@ Please submit there instead, or use --nodevelproject to force direct submission.
arg_arch = arg
if not (arg == osc.build.hostarch or arg in osc.build.can_also_build.get(osc.build.hostarch, [])):
if not (vm_type == 'qemu' or vm_type == 'emulator'):
print("WARNING: native compile is not possible, a emulator via binfmt misc handler must be configured!")
print("WARNING: native compile is not possible, a emulator via binfmt misc handler must be configured!")
elif not arg_repository:
arg_repository = arg
else:
# raise oscerr.WrongArgs('\'%s\' is neither a build description nor a supported arch' % arg)
# raise oscerr.WrongArgs('\'%s\' is neither a build description nor a supported arch' % arg)
# take it as arch (even though this is no supported arch) - hopefully, this invalid
# arch will be detected below
arg_arch = arg
@ -6680,9 +6680,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
# build env not specified, just read from last build attempt
lastbuildroot = store_read_last_buildroot(os.curdir)
if lastbuildroot:
args = [ lastbuildroot[0], lastbuildroot[1] ]
if not opts.vm_type:
opts.vm_type = lastbuildroot[2]
args = [lastbuildroot[0], lastbuildroot[1]]
if not opts.vm_type:
opts.vm_type = lastbuildroot[2]
vm_chroot = opts.vm_type or conf.config['build-type']
if (subcmd in ('shell', 'chroot') or opts.shell or opts.wipe) and not vm_chroot:
@ -6820,7 +6820,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
break
if gi:
hostglobalargs = sys.argv[gi : sys.argv.index(subcmd)+1]
hostglobalargs = sys.argv[gi: sys.argv.index(subcmd) + 1]
else:
hostglobalargs = (subcmd, )
@ -7400,7 +7400,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if is_package_dir(os.getcwd()):
project = store_read_project(os.curdir)
package = store_read_package(os.curdir)
if project is None:
if project is None:
raise oscerr.WrongArgs('Missing <project> argument.')
if len(args) > 2:
raise oscerr.WrongArgs('Wrong number of arguments.')
@ -7491,7 +7491,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if len(args) == 4 or len(args) == 5:
project = args[0]
package = args[1]
repository = args[2]
repository = args[2]
architecture = args[3]
if len(args) == 5:
binary = args[4]
@ -7506,7 +7506,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
else:
raise oscerr.WrongArgs('Missing arguments: either specify <project> and ' \
'<package> or move to a project or package working copy')
repository = args[0]
repository = args[0]
if len(args) == 2:
architecture = args[1]
else:
@ -7684,7 +7684,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if list_patchinfos:
u = makeurl(apiurl, ['/search/package'], {
'match' : "([kind='patchinfo' and issue[@state='OPEN' and owner/@login='%s']])" % user
'match': "([kind='patchinfo' and issue[@state='OPEN' and owner/@login='%s']])" % user
})
f = http_GET(u)
root = ET.parse(f).getroot()
@ -8041,7 +8041,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
# construct a sorted, flat list
# Sort by first column, follwed by second column if we have two columns, else sort by first.
if len(results[0]) > 1:
sorted_results = sorted(results, key=itemgetter(0,1))
sorted_results = sorted(results, key=itemgetter(0, 1))
else:
sorted_results = sorted(results, key=itemgetter(0))
new = []
@ -8426,7 +8426,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
result = searchresult.find('owner')
print("This is: " + result.get('project'), end=' ')
if result.get('package'):
print (" / " + result.get('package'))
print(" / " + result.get('package'))
repl = raw_input('\nUse this container? (y/n) ')
if repl.lower() != 'y':
searchresult = None
@ -8559,9 +8559,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if opts.bugowner and not len(maintainers.get(role, [])):
role = 'maintainer'
if pac:
print("%s%s of %s/%s : " %(indent, role, prj, pac))
print("%s%s of %s/%s : " % (indent, role, prj, pac))
else:
print("%s%s of %s : " %(indent, role, prj))
print("%s%s of %s : " % (indent, role, prj))
if opts.email:
emails = []
for maintainer in maintainers.get(role, []):
@ -8575,8 +8575,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
for maintainer in maintainers.get(role, []):
user = get_maintainer_data(apiurl, maintainer, verbose=True)
userdata.append(user[0])
if user[1] != '-':
userdata.append("%s <%s>"%(user[1], user[2]))
if user[1] != '-':
userdata.append("%s <%s>" % (user[1], user[2]))
else:
userdata.append(user[2])
for row in build_table(2, userdata, None, 3):
@ -8603,7 +8603,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
for name in usernames:
user = get_user_data(apiurl, name, 'login', 'realname', 'email')
if len(user) == 3:
print("%s: \"%s\" <%s>"%(user[0], user[1], user[2]))
print("%s: \"%s\" <%s>" % (user[0], user[1], user[2]))
@cmdln.option('-r', '--revision', metavar='rev',
@ -8869,7 +8869,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
pac.put_on_conflictlist(name)
continue
o = open(os.path.join(destdir, name), 'wb')
o = open(os.path.join(destdir, name), 'wb')
code = run_external('diff3', '-m', '-E',
'-L', '.mine',
os.path.join(destdir, name + '.mine'),

View File

@ -291,9 +291,9 @@ class Serviceinfo:
def __init__(self):
"""creates an empty serviceinfo instance"""
self.services = []
self.apiurl = None
self.project = None
self.package = None
self.apiurl = None
self.project = None
self.package = None
def read(self, serviceinfo_node, append=False):
"""read in the source services <services> element passed as
@ -316,7 +316,7 @@ class Serviceinfo:
if len(name) < 3 or '/' in name:
error("invalid service name: %s" % name, service)
mode = service.get('mode', '')
data = { 'name' : name, 'mode' : mode }
data = {'name': name, 'mode': mode}
command = [ name ]
for param in service.findall('param'):
option = param.get('name')
@ -359,7 +359,7 @@ class Serviceinfo:
r = serviceinfo_node
s = ET.Element( "service", name="verify_file" )
ET.SubElement(s, "param", name="file").text = filename
ET.SubElement(s, "param", name="verifier").text = "sha256"
ET.SubElement(s, "param", name="verifier").text = "sha256"
ET.SubElement(s, "param", name="checksum").text = digest
r.append( s )
@ -375,10 +375,10 @@ class Serviceinfo:
r = serviceinfo_node
s = ET.Element( "service", name="download_url" )
ET.SubElement(s, "param", name="protocol").text = protocol
ET.SubElement(s, "param", name="host").text = host
ET.SubElement(s, "param", name="path").text = path
ET.SubElement(s, "param", name="host").text = host
ET.SubElement(s, "param", name="path").text = path
r.append( s )
r.append(s)
return r
def addSetVersion(self, serviceinfo_node):
@ -453,7 +453,7 @@ class Serviceinfo:
# set environment when using OBS 2.3 or later
if self.project != None:
# These need to be kept in sync with bs_service
os.putenv("OBS_SERVICE_APIURL", self.apiurl)
os.putenv("OBS_SERVICE_APIURL", self.apiurl)
os.putenv("OBS_SERVICE_PROJECT", self.project)
os.putenv("OBS_SERVICE_PACKAGE", self.package)
# also export vc env vars (some services (like obs_scm) use them)
@ -481,8 +481,8 @@ class Serviceinfo:
try:
temp_dir = tempfile.mkdtemp(dir=dir, suffix='.%s.service' % service['name'])
cmd = service['command']
if not os.path.exists("/usr/lib/obs/service/"+cmd[0]):
raise oscerr.PackageNotInstalled("obs-service-%s"%cmd[0])
if not os.path.exists("/usr/lib/obs/service/" + cmd[0]):
raise oscerr.PackageNotInstalled("obs-service-%s" % cmd[0])
cmd[0] = "/usr/lib/obs/service/"+cmd[0]
cmd = cmd + [ "--outdir", temp_dir ]
if conf.config['verbose'] > 1 or verbose or conf.config['debug']:
@ -533,9 +533,9 @@ class Linkinfo:
self.package = linkinfo_node.get('package')
self.xsrcmd5 = linkinfo_node.get('xsrcmd5')
self.lsrcmd5 = linkinfo_node.get('lsrcmd5')
self.srcmd5 = linkinfo_node.get('srcmd5')
self.error = linkinfo_node.get('error')
self.rev = linkinfo_node.get('rev')
self.srcmd5 = linkinfo_node.get('srcmd5')
self.error = linkinfo_node.get('error')
self.rev = linkinfo_node.get('rev')
self.baserev = linkinfo_node.get('baserev')
def islink(self):
@ -2387,7 +2387,7 @@ rev: %s
# the file was already deleted but we cannot know this
# OR we're processing a _service: file (simply keep the file)
if os.path.isfile(os.path.join(self.storedir, f.name)) and self.status(f.name) not in ('M', 'C'):
# if self.status(f.name) != 'M':
# if self.status(f.name) != 'M':
self.delete_localfile(f.name)
self.delete_storefile(f.name)
print(statfrmt('D', os.path.join(pathn, f.name)))
@ -4310,11 +4310,11 @@ def create_submit_request(apiurl,
root = res['project_id']
project = root.find('project')
if project is None:
print("WARNING: This project is not maintained in the maintenance project specified by '%s', looking elsewhere" % conf.config['maintenance_attribute'])
xpath = 'maintenance/maintains/@project = \'%s\'' % dst_project
res = search(apiurl, project_id=xpath)
root = res['project_id']
project = root.find('project')
print("WARNING: This project is not maintained in the maintenance project specified by '%s', looking elsewhere" % conf.config['maintenance_attribute'])
xpath = 'maintenance/maintains/@project = \'%s\'' % dst_project
res = search(apiurl, project_id=xpath)
root = res['project_id']
project = root.find('project')
if project is None:
raise oscerr.APIError("Server did not define a default maintenance project, can't submit.")
tproject = project.get('name')
@ -4447,11 +4447,11 @@ def get_review_list(apiurl, project='', package='', byuser='', bygroup='', bypro
# this function uses the logic in the api which is faster and more exact then the xpath search
def get_request_collection(apiurl, role=None, req_who=None, req_states=('new', 'review', 'declined')):
query={ "view" : "collection" }
query = {"view": "collection"}
if role:
query["roles"] = role
query["roles"] = role
if req_who:
query["user"] = req_who
query["user"] = req_who
query["states"] = ",".join(req_states)
@ -4624,10 +4624,10 @@ def check_existing_maintenance_requests(apiurl, src_project, src_packages, dst_p
release_project, ask=True):
reqs = []
for src_package in src_packages:
reqs += get_exact_request_list(apiurl, src_project, dst_project,
src_package, None,
req_type='maintenance_incident',
req_state=['new', 'review', 'declined'])
reqs += get_exact_request_list(apiurl, src_project, dst_project,
src_package, None,
req_type='maintenance_incident',
req_state=['new', 'review', 'declined'])
if not ask:
return True, reqs
repl = ''
@ -4853,7 +4853,7 @@ def get_source_file_diff(dir, filename, rev, oldfilename = None, olddir = None,
from_file = b'%s\t(revision %s)' % (origfilename.encode(), str(rev).encode())
to_file = b'%s\t(working copy)' % origfilename.encode()
if sys.version_info < (3,0):
if sys.version_info < (3, 0):
d = difflib.unified_diff(s1, s2,
fromfile = from_file, \
tofile = to_file)
@ -5174,7 +5174,7 @@ def replace_pkg_meta(pkgmeta, new_name, new_prj, keep_maintainers = False,
root.remove(dp)
return ET.tostring(root, encoding=ET_ENCODING)
def link_to_branch(apiurl, project, package):
def link_to_branch(apiurl, project, package):
"""
convert a package with a _link + project.diff to a branch
"""
@ -5205,7 +5205,7 @@ def link_pac(src_project, src_package, dst_project, dst_package, force, rev='',
meta_change = True
except HTTPError as e:
if e.code != 404:
raise
raise
meta_change = True
if meta_change:
if missing_target:
@ -5300,7 +5300,7 @@ def aggregate_pac(src_project, src_package, dst_project, dst_package, repo_map =
meta_change = True
except HTTPError as e:
if e.code != 404:
raise
raise
meta_change = True
if meta_change:
@ -5452,8 +5452,8 @@ def branch_pkg(apiurl, src_project, src_package, nodevelproject=False, rev=None,
except HTTPError as e:
root = ET.fromstring(e.read())
if missingok:
if root and root.get('code') == "not_missing":
raise oscerr.NotMissing("Package exists already via project link, but link will point to given project")
if root and root.get('code') == "not_missing":
raise oscerr.NotMissing("Package exists already via project link, but link will point to given project")
summary = root.find('summary')
if summary is None:
raise oscerr.APIError('unexpected response:\n%s' % ET.tostring(root, encoding=ET_ENCODING))
@ -5640,7 +5640,7 @@ def get_distibutions(apiurl, discon=False):
rmap = {}
rmap['name'] = node.get('name').replace('DISCONTINUED:', '').replace(':', ' ')
rmap['project'] = node.get('name')
r.append (result_line_templ % rmap)
r.append(result_line_templ % rmap)
r.insert(0, 'distribution project')
r.insert(1, '------------ -------')
@ -6096,7 +6096,7 @@ def get_prj_results(apiurl, prj, hide_legend=False, csv=False, status_filter=Non
else:
offset = 0
for tg in targets:
r.append('| ' * offset + '%s %s (%s)'%tg )
r.append('| ' * offset + '%s %s (%s)' % tg)
offset += 1
for pac in pacs:
@ -6120,7 +6120,7 @@ def get_prj_results(apiurl, prj, hide_legend=False, csv=False, status_filter=Non
line = []
for i in range(0, len(targets)):
line.append(str(i%10))
line.append(str(i % 10))
r.append(' '.join(line))
r.append('')
@ -6136,7 +6136,7 @@ def get_prj_results(apiurl, prj, hide_legend=False, csv=False, status_filter=Non
if vertical:
for i in range(0, len(targets)):
s = '%1d %s %s (%s)' % (i%10, targets[i][0], targets[i][1], targets[i][2])
s = '%1d %s %s (%s)' % (i % 10, targets[i][0], targets[i][1], targets[i][2])
if i < len(legend):
legend[i] += s
else:
@ -6365,12 +6365,12 @@ def get_buildhistory(apiurl, prj, package, repository, arch, format = 'text', li
t = time.gmtime(int(node.get('time')))
t = time.strftime('%Y-%m-%d %H:%M:%S', t)
if duration == None:
duration = ""
duration = ""
if format == 'csv':
r.append('%s|%s|%s|%s.%d|%s' % (t, srcmd5, rev, versrel, bcnt, duration))
else:
bversrel='%s.%d' % (versrel, bcnt)
bversrel = '%s.%d' % (versrel, bcnt)
r.append('%s %s %s %s %s' % (t, srcmd5, bversrel.ljust(16)[:16], rev, duration.rjust(10)))
if format == 'text':
@ -6794,7 +6794,7 @@ def build_table(col_num, data = [], headline = [], width=1, csv = False):
table.append(row)
# there is no need to justify the entries of the last column
# or when generating csv
if i == col_num -1 or csv:
if i == col_num - 1 or csv:
row.append(itm)
else:
row.append(itm.ljust(longest_col[i]))
@ -7113,12 +7113,12 @@ def setBugowner(apiurl, prj, pac, user=None, group=None):
template_args=None,
create_new=False)
if user.startswith('group:'):
group=user.replace('group:', '')
user=None
group = user.replace('group:', '')
user = None
if data:
root = ET.fromstring(parse_meta_to_string(data))
for group_element in root.getiterator('group'):
if group_element.get('role') == "bugowner":
if group_element.get('role') == "bugowner":
root.remove(group_element)
for person_element in root.getiterator('person'):
if person_element.get('role') == "bugowner":
@ -7609,7 +7609,7 @@ def request_interactive_review(apiurl, request, initial_cmd='', group=None,
create_comment(apiurl, 'request', comment, request.reqid)
elif repl == 'b' and src_actions:
print_source_buildstatus(src_actions)
elif repl =='li' and src_actions:
elif repl == 'li' and src_actions:
safe_get_rpmlint_log(src_actions)
elif repl == 'e' and editable_actions:
# this is only for editable actions
@ -7944,7 +7944,7 @@ def print_comments(apiurl, kind, *args):
for comment in comments:
print(indent, end='')
print('(', comment.get('id'), ')', 'On', comment.get('when'), comment.get('who'), 'wrote:')
text = indent + comment.text.replace('\r\n',' \n')
text = indent + comment.text.replace('\r\n', ' \n')
print(('\n' + indent).join(text.split('\n')))
print()
print_rec([c for c in root if c.get('parent') == comment.get('id')], indent + ' ')

View File

@ -21,11 +21,11 @@ def namespace(name):
return "{http://linux.duke.edu/metadata/%s}" % name
OPERATOR_BY_FLAGS = {
"EQ" : "=",
"LE" : "<=",
"GE" : ">=",
"LT" : "<",
"GT" : ">"
"EQ": "=",
"LE": "<=",
"GE": ">=",
"LT": "<",
"GT": ">"
}
def primaryPath(directory):