BaseTools ConvertMasmToNasm: put filter/map result in tuple for python3

Python 3's filter and map functions returns an iterator which you
can't call len() on. Since we'll want to use len() later, we put the
filter results into a tuple.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Jordan Justen 2016-03-16 16:14:14 -07:00
parent c8102434ba
commit 90694f1218
1 changed files with 2 additions and 2 deletions

View File

@ -473,7 +473,7 @@ class ConvertAsmFile(CommonUtils):
self.EmitAsmWithComment(oldAsm, newAsm, endOfLine)
uses = self.mo.group(3)
if uses is not None:
uses = filter(None, uses.split())
uses = tuple(filter(None, uses.split()))
else:
uses = tuple()
self.uses = uses
@ -484,7 +484,7 @@ class ConvertAsmFile(CommonUtils):
self.EmitAsmWithComment(oldAsm, newAsm, endOfLine)
elif self.MatchAndSetMo(self.publicRe, oldAsm):
publics = re.findall(self.varAndTypeSubRe, self.mo.group(1))
publics = map(lambda p: p.split(':')[0].strip(), publics)
publics = tuple(map(lambda p: p.split(':')[0].strip(), publics))
for i in range(len(publics) - 1):
name = publics[i]
self.EmitNewContent('global ASM_PFX(%s)' % publics[i])