From e992a5bb8ed77fe6f9e46da1e2add3c5f12038f8 Mon Sep 17 00:00:00 2001 From: Kyle Stewart <4b796c65+bitbucket@gmail.com> Date: Thu, 17 Mar 2016 05:25:28 -0700 Subject: use context manager when reading requires.txt --- wheel/metadata.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wheel/metadata.py b/wheel/metadata.py index b3cc65c..d037c3a 100644 --- a/wheel/metadata.py +++ b/wheel/metadata.py @@ -244,7 +244,8 @@ def pkginfo_to_metadata(egg_info_path, pkginfo_path): pkg_info.replace_header('Metadata-Version', '2.0') requires_path = os.path.join(egg_info_path, 'requires.txt') if os.path.exists(requires_path): - requires = open(requires_path).read() + with open(requires_path) as requires_file: + requires = requires_file.read() for extra, reqs in sorted(pkg_resources.split_sections(requires), key=lambda x: x[0] or ''): condition = '' -- cgit v1.2.1