0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-21 21:19:50 +01:00

build: avoid using CMP for BZ2File

Some Python distributions do not support
context manager protocol (CMP) for BZ2File.

PR-URL: https://github.com/nodejs/node/pull/31198
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Christian Clauss <cclauss@me.com>
This commit is contained in:
SpaceRacet5w2A6l0I 2020-01-05 19:07:19 +01:00 committed by Rich Trott
parent 96eceb7519
commit bd6d6512f0

View File

@ -1540,8 +1540,11 @@ def configure_intl(o):
os.mkdir(icu_tmp_path)
icu_data_path = os.path.join(icu_tmp_path, icu_data_file_l)
with open(icu_data_path, 'wb') as outf:
with bz2.BZ2File(compressed_data, 'rb') as inf:
shutil.copyfileobj(inf, outf)
inf = bz2.BZ2File(compressed_data, 'rb')
try:
shutil.copyfileobj(inf, outf)
finally:
inf.close()
# Now, proceed..
# relative to dep..