Python 3 Fix: dict().iteritems no longer exists
Use six.iteritems() instead of dict().iteritems. Change-Id: I53f7d18a06b8f0b8dba906824db9d2a44d4335d1
This commit is contained in:
parent
74fa3865ac
commit
05d9266c6f
@ -19,6 +19,9 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
import six
|
||||||
|
|
||||||
|
|
||||||
OrderedDict = extras.try_imports(['collections.OrderedDict',
|
OrderedDict = extras.try_imports(['collections.OrderedDict',
|
||||||
'ordereddict.OrderedDict'])
|
'ordereddict.OrderedDict'])
|
||||||
|
|
||||||
@ -59,17 +62,17 @@ class CloneMapper(object):
|
|||||||
raise Exception("Expansion error. Check error messages above")
|
raise Exception("Expansion error. Check error messages above")
|
||||||
|
|
||||||
self.log.info("Mapping projects to workspace...")
|
self.log.info("Mapping projects to workspace...")
|
||||||
for project, dest in ret.iteritems():
|
for project, dest in six.iteritems(ret):
|
||||||
dest = os.path.normpath(os.path.join(workspace, dest[0]))
|
dest = os.path.normpath(os.path.join(workspace, dest[0]))
|
||||||
ret[project] = dest
|
ret[project] = dest
|
||||||
self.log.info(" %s -> %s", project, dest)
|
self.log.info(" %s -> %s", project, dest)
|
||||||
|
|
||||||
self.log.debug("Checking overlap in destination directories...")
|
self.log.debug("Checking overlap in destination directories...")
|
||||||
check = defaultdict(list)
|
check = defaultdict(list)
|
||||||
for project, dest in ret.iteritems():
|
for project, dest in six.iteritems(ret):
|
||||||
check[dest].append(project)
|
check[dest].append(project)
|
||||||
|
|
||||||
dupes = dict((d, p) for (d, p) in check.iteritems() if len(p) > 1)
|
dupes = dict((d, p) for (d, p) in six.iteritems(check) if len(p) > 1)
|
||||||
if dupes:
|
if dupes:
|
||||||
raise Exception("Some projects share the same destination: %s",
|
raise Exception("Some projects share the same destination: %s",
|
||||||
dupes)
|
dupes)
|
||||||
|
@ -19,6 +19,8 @@ import os
|
|||||||
import re
|
import re
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
import six
|
||||||
|
|
||||||
from git import GitCommandError
|
from git import GitCommandError
|
||||||
from zuul.lib.clonemapper import CloneMapper
|
from zuul.lib.clonemapper import CloneMapper
|
||||||
from zuul.merger.merger import Repo
|
from zuul.merger.merger import Repo
|
||||||
@ -62,7 +64,7 @@ class Cloner(object):
|
|||||||
dests = mapper.expand(workspace=self.workspace)
|
dests = mapper.expand(workspace=self.workspace)
|
||||||
|
|
||||||
self.log.info("Preparing %s repositories", len(dests))
|
self.log.info("Preparing %s repositories", len(dests))
|
||||||
for project, dest in dests.iteritems():
|
for project, dest in six.iteritems(dests):
|
||||||
self.prepareRepo(project, dest)
|
self.prepareRepo(project, dest)
|
||||||
self.log.info("Prepared all repositories")
|
self.log.info("Prepared all repositories")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user