aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2012-01-20 14:11:03 -0500
committerJason R. Coombs <jaraco@jaraco.com>2012-01-20 14:11:03 -0500
commit5e53787185059a78874e2f730c431ec611b0b8e7 (patch)
treeab743de1096efd7e64dd4acf4d3e63c0593d4f61
parent28f1f51717d813a91f6f290cac073b67257e266d (diff)
downloadexternal_python_setuptools-5e53787185059a78874e2f730c431ec611b0b8e7.tar.gz
external_python_setuptools-5e53787185059a78874e2f730c431ec611b0b8e7.tar.bz2
external_python_setuptools-5e53787185059a78874e2f730c431ec611b0b8e7.zip
Remove grody hack for later versions of Python where it is no longer necessary. Fixes #269.
--HG-- branch : distribute extra : rebase_source : c4f18c8760303a2228baf5b88ec1f59a865999a5
-rw-r--r--CHANGES.txt2
-rwxr-xr-xsetuptools/command/sdist.py18
2 files changed, 16 insertions, 4 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index a245b2a4..3c13ae20 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -11,6 +11,8 @@ CHANGES
Python 2.6 and later.
* Issue #262: package_index.open_with_auth no longer throws LookupError
on Python 3.
+* Issue #269: AttributeError when an exception occurs reading Manifest.in
+ on late releases of Python.
------
0.6.24
diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py
index 3442fe4b..c49839cd 100755
--- a/setuptools/command/sdist.py
+++ b/setuptools/command/sdist.py
@@ -199,15 +199,25 @@ class sdist(_sdist):
build_scripts = self.get_finalized_command('build_scripts')
self.filelist.extend(build_scripts.get_source_files())
- def read_template(self):
+ def __read_template_hack(self):
+ # This grody hack closes the template file (MANIFEST.in) if an
+ # exception occurs during read_template.
+ # Doing so prevents an error when easy_install attempts to delete the
+ # file.
try:
_sdist.read_template(self)
except:
- # grody hack to close the template file (MANIFEST.in)
- # this prevents easy_install's attempt at deleting the file from
- # dying and thus masking the real error
sys.exc_info()[2].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
+ # has been fixed, so only override the method if we're using an earlier
+ # Python.
+ if (
+ sys.version_info < (2,7,2)
+ or (3,0) <= sys.version_info < (3,1,4)
+ or (3,2) <= sys.version_info < (3,2,1)
+ ):
+ read_template = __read_template_hack
def check_readme(self):
alts = ("README", "README.txt")