mirror of
https://github.com/openSUSE/osc.git
synced 2025-08-30 18:04:11 +02:00
python3 compatibility: dict
this patch 1.) removes the iteritems/itervalues, which were dropped in py3 items/values are used instead 2.) add an extra list() in a cases the list-based access is needed (included appending, indexing and so) 3.) changes a sorting idiom in few places instead of foo = dict.keys() foo.sort() for i in foo: there is a recommended for i in sorted(dict.keys()): 4.) in one occassion it removes a if dict.has_key() by simpler dict.get(key, default)
This commit is contained in:
@@ -331,7 +331,7 @@ def get_prefer_pkgs(dirs, wanted_arch, type):
|
||||
packageQueries.add(packageQuery)
|
||||
|
||||
prefer_pkgs = dict((name, packageQuery.path())
|
||||
for name, packageQuery in packageQueries.iteritems())
|
||||
for name, packageQuery in packageQueries.items())
|
||||
|
||||
depfile = create_deps(packageQueries.values())
|
||||
cpio = cpio.CpioWrite()
|
||||
@@ -631,7 +631,7 @@ def main(apiurl, opts, argv):
|
||||
else:
|
||||
raise
|
||||
|
||||
bi = Buildinfo(bi_filename, apiurl, build_type, prefer_pkgs.keys())
|
||||
bi = Buildinfo(bi_filename, apiurl, build_type, list(prefer_pkgs.keys()))
|
||||
|
||||
if bi.debuginfo and not (opts.disable_debuginfo or '--debug' in buildargs):
|
||||
buildargs.append('--debug')
|
||||
@@ -660,7 +660,7 @@ def main(apiurl, opts, argv):
|
||||
rpmlist_prefers = []
|
||||
if prefer_pkgs:
|
||||
print 'Evaluating preferred packages'
|
||||
for name, path in prefer_pkgs.iteritems():
|
||||
for name, path in prefer_pkgs.tems():
|
||||
if bi.has_dep(name):
|
||||
# We remove a preferred package from the buildinfo, so that the
|
||||
# fetcher doesn't take care about them.
|
||||
@@ -804,7 +804,7 @@ def main(apiurl, opts, argv):
|
||||
else:
|
||||
os.symlink(sffn, tffn)
|
||||
if prefer_pkgs:
|
||||
for name, path in prefer_pkgs.iteritems():
|
||||
for name, path in prefer_pkgs.items():
|
||||
if name == filename:
|
||||
print "Using prefered package: " + path + "/" + filename
|
||||
os.unlink(tffn)
|
||||
|
Reference in New Issue
Block a user