summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Stewart <4b796c65+bitbucket@gmail.com>2016-03-17 05:25:28 -0700
committerKyle Stewart <4b796c65+bitbucket@gmail.com>2016-03-17 05:25:28 -0700
commite992a5bb8ed77fe6f9e46da1e2add3c5f12038f8 (patch)
treec7ad274fb86241e586b6f7a8f7f5f801a23caeaa
parent80a06d58f7e5fbf2cc54ec3dbc3f90f188d58bcb (diff)
downloadwheel-e992a5bb8ed77fe6f9e46da1e2add3c5f12038f8.tar.gz
use context manager when reading requires.txt
-rw-r--r--wheel/metadata.py3
1 files changed, 2 insertions, 1 deletions
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 = ''