diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2015-12-31 10:51:55 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2015-12-31 10:51:55 -0500 |
commit | 29fa01621c3de0a5c78c4f49b5d051386d0d566f (patch) | |
tree | fce7387c8ba82178be987b004cbda1c22005a04f /setuptools/command/sdist.py | |
parent | 928324bd76f35e9c8c526df828577b5640a95ed0 (diff) | |
parent | 6bdbe8957d8c8d293e3fea3fa4baf45eb7c3a3a4 (diff) | |
download | external_python_setuptools-29fa01621c3de0a5c78c4f49b5d051386d0d566f.tar.gz external_python_setuptools-29fa01621c3de0a5c78c4f49b5d051386d0d566f.tar.bz2 external_python_setuptools-29fa01621c3de0a5c78c4f49b5d051386d0d566f.zip |
Merge with master. Ref #229.
--HG--
branch : feature/issue-229
Diffstat (limited to 'setuptools/command/sdist.py')
-rwxr-xr-x | setuptools/command/sdist.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py index 4ec7ec91..3b9f7dd5 100755 --- a/setuptools/command/sdist.py +++ b/setuptools/command/sdist.py @@ -3,6 +3,7 @@ from distutils import log import distutils.command.sdist as orig import os import sys +import io import six @@ -71,7 +72,8 @@ class sdist(orig.sdist): try: orig.sdist.read_template(self) except: - sys.exc_info()[2].tb_next.tb_frame.f_locals['template'].close() + _, _, tb = sys.exc_info() + tb.tb_next.tb_frame.f_locals['template'].close() raise # Beginning with Python 2.7.2, 3.1.4, and 3.2.1, this leaky file handle @@ -166,11 +168,8 @@ class sdist(orig.sdist): if not os.path.isfile(self.manifest): return False - fp = open(self.manifest, 'rbU') - try: + with io.open(self.manifest, 'rb') as fp: first_line = fp.readline() - finally: - fp.close() return (first_line != '# file GENERATED by distutils, do NOT edit\n'.encode()) |