Commit b49029a6 authored by Ming Rui Zhang's avatar Ming Rui Zhang Committed by Andreas Traczyk

build: ignore python utf-8 parsing errors when decoding env vars

Change-Id: I362550773790643a663b6e8da70b48cb1064b391
parent 444e0f0c
......@@ -102,7 +102,7 @@ def getVSEnv(arch='x64', platform='', version=''):
shell=True,
stdout=subprocess.PIPE)
stdout, _ = p.communicate()
out = stdout.decode('utf-8').split("\r\n")[5:-1]
out = stdout.decode('utf-8', errors='ignore').split("\r\n")[5:-1]
return dict(s.split('=', 1) for s in out)
......@@ -157,7 +157,7 @@ def make(pkg_info, force, sdk_version, toolset):
os.remove(build_file)
else:
pkg_build_uptodate = is_build_uptodate(pkg_name, build_file)
with open(build_file, 'r+') as f:
with open(build_file, 'r+', encoding="utf8", errors='ignore') as f:
current_version = f.read()
if current_version == version:
pkg_ver_uptodate = True
......@@ -242,7 +242,7 @@ def remove_archive_if_needed(pkg_build_path, dirty_path):
def extract_tar(pkg_build_path, name, path):
with tarfile.open(path, 'r') as tarball:
with tarfile.open(path, 'r', encoding="utf8", errors='ignore') as tarball:
tar_common_prefix = os.path.commonprefix(tarball.getnames())
dirty_path = contrib_build_dir + '\\' + tar_common_prefix
remove_archive_if_needed(pkg_build_path, dirty_path)
......@@ -332,7 +332,7 @@ def get_pkg_file(pkg_name):
def resolve(pkg_name, force=False, sdk_version='', toolset=''):
pkg_json_file = get_pkg_file(pkg_name)
with open(pkg_json_file) as json_file:
with open(pkg_json_file, encoding="utf8", errors='ignore') as json_file:
log.info('Resolving: ' + pkg_name)
pkg_info = json.load(json_file)
try:
......@@ -345,7 +345,7 @@ def resolve(pkg_name, force=False, sdk_version='', toolset=''):
def track_build(pkg_name, version):
build_file = contrib_build_dir + '\\.' + pkg_name
f = open(build_file, "w+")
f = open(build_file, "w+", encoding="utf8", errors='ignore')
f.write(version)
f.close()
......@@ -537,6 +537,11 @@ class MSbuilder:
def build(self, pkg_name, proj_path, sdk_version, toolset):
if not os.path.isfile(self.msbuild):
raise IOError('msbuild.exe not found. path=' + self.msbuild)
if os.environ.get('JENKINS_URL'):
log.info("Jenkins Clear DebugInformationFormat")
self.__class__.replace_vs_prop(proj_path,
'DebugInformationFormat',
'None')
# force chosen sdk
self.__class__.replace_vs_prop(proj_path,
'WindowsTargetPlatformVersion',
......@@ -637,7 +642,7 @@ def main():
getSHrunner().exec_batch('rmdir', ['/s', '/q', contrib_build_dir])
else:
pkg_json_file = get_pkg_file(parsed_args.clean)
with open(pkg_json_file) as json_file:
with open(pkg_json_file, encoding="utf8", errors='ignore') as json_file:
pkg_info = json.load(json_file)
dir_to_clean = contrib_build_dir + '\\' + pkg_info['name']
file_to_clean = contrib_build_dir + '\\.' + pkg_info['name']
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment