BaseTools:use iterate list to replace the itertools

itertools.imap() replace map(), itertools.ifilter() replace filter

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
This commit is contained in:
Zhijux Fan 2018-12-06 09:09:36 +08:00 committed by Feng, Bob C
parent e77e59c9bd
commit 2f28dca16f
1 changed files with 2 additions and 4 deletions
BaseTools/Source/Python/build

View File

@ -27,7 +27,6 @@ import time
import platform
import traceback
import encodings.ascii
import itertools
import multiprocessing
from struct import *
@ -1102,9 +1101,8 @@ class Build():
f = open(PrebuildEnvFile)
envs = f.readlines()
f.close()
envs = itertools.imap(lambda l: l.split('=', 1), envs)
envs = itertools.ifilter(lambda l: len(l) == 2, envs)
envs = itertools.imap(lambda l: [i.strip() for i in l], envs)
envs = [l.split("=", 1) for l in envs ]
envs = [[I.strip() for I in item] for item in envs if len(item) == 2]
os.environ.update(dict(envs))
EdkLogger.info("\n- Prebuild Done -\n")