From 779d7efa72ed514ab81c800c74052c96ad102c08 Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Mon, 21 Oct 2019 22:26:02 +1100 Subject: [PATCH] build: python3 support for configure PR-URL: https://github.com/nodejs/node/pull/30047 Reviewed-By: Christian Clauss Reviewed-By: Sam Roberts Reviewed-By: Richard Lau Reviewed-By: David Carlier --- configure.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/configure.py b/configure.py index bfc50d7fbde..8790b3c13fc 100755 --- a/configure.py +++ b/configure.py @@ -12,6 +12,7 @@ import shlex import subprocess import shutil import bz2 +import io from distutils.spawn import find_executable as which from distutils.version import StrictVersion @@ -1497,10 +1498,11 @@ def configure_intl(o): icu_ver_major = None matchVerExp = r'^\s*#define\s+U_ICU_VERSION_SHORT\s+"([^"]*)".*' match_version = re.compile(matchVerExp) - for line in open(uvernum_h).readlines(): - m = match_version.match(line) - if m: - icu_ver_major = m.group(1) + with io.open(uvernum_h, encoding='utf8') as in_file: + for line in in_file: + m = match_version.match(line) + if m: + icu_ver_major = str(m.group(1)) if not icu_ver_major: error('Could not read U_ICU_VERSION_SHORT version from %s' % uvernum_h) elif int(icu_ver_major) < icu_versions['minimum_icu']: