From 95b0a868f255f2766ae03733882f30c8c7f3b7ca Mon Sep 17 00:00:00 2001 From: Jeremy Heiner Date: Sat, 12 Oct 2013 12:44:33 -0400 Subject: Use dict iteration methods common to both Python 2 and 3. The .items, .keys, and .values methods in Python 2 make copies, so the test framework uses the .iter* flavors of those methods. But in Python 3 those .iter* (and even the 2.7 .view*) flavors are removed and the original methods return views. Measurements were taken under Python2 to see what impact the copying had, and there was none. Thus it is not worth the effort to avoid. Reported as a compatibility issue by 2to3. Signed-off-by: Jeremy Heiner Signed-off-by: Allan McRae --- test/pacman/util.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/pacman/util.py') diff --git a/test/pacman/util.py b/test/pacman/util.py index c1ab390e..ab5a6f47 100644 --- a/test/pacman/util.py +++ b/test/pacman/util.py @@ -112,13 +112,13 @@ def writedata(filename, data): def mkcfgfile(filename, root, option, db): # Options data = ["[options]"] - for key, value in option.iteritems(): + for key, value in option.items(): data.extend(["%s = %s" % (key, j) for j in value]) # Repositories # sort by repo name so tests can predict repo order, rather than be # subjects to the whims of python dict() ordering - for key in sorted(db.iterkeys()): + for key in sorted(db.keys()): if key != "local": value = db[key] data.append("[%s]\n" \ @@ -126,7 +126,7 @@ def mkcfgfile(filename, root, option, db): "Server = file://%s" \ % (value.treename, value.getverify(), \ os.path.join(root, SYNCREPO, value.treename))) - for optkey, optval in value.option.iteritems(): + for optkey, optval in value.option.items(): data.extend(["%s = %s" % (optkey, j) for j in optval]) mkfile(root, filename, "\n".join(data)) -- cgit v1.2.3