From b89cda4cbdef54d9a987bb91a3fc2ed3fc392c8e Mon Sep 17 00:00:00 2001 From: Dmitriy Kasyanov Date: Wed, 13 Dec 2017 23:21:24 +0200 Subject: [PATCH] tools: fix AttributeError: __exit__ on Python 2.6 Error occurs while dealing with Tar archives PR-URL: https://github.com/nodejs/node/pull/17663 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Steven R Loomis Reviewed-By: Colin Ihrig --- tools/configure.d/nodedownload.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/configure.d/nodedownload.py b/tools/configure.d/nodedownload.py index 5cf8e0dbd690e1..3f4bc090f71bdd 100644 --- a/tools/configure.d/nodedownload.py +++ b/tools/configure.d/nodedownload.py @@ -60,7 +60,7 @@ def unpack(packedfile, parent_path): icuzip.extractall(parent_path) return parent_path elif tarfile.is_tarfile(packedfile): - with tarfile.TarFile.open(packedfile, 'r') as icuzip: + with contextlib.closing(tarfile.TarFile.open(packedfile, 'r')) as icuzip: print ' Extracting tarfile: %s' % packedfile icuzip.extractall(parent_path) return parent_path