summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2013-05-11 13:05:32 +0100
committerJason R. Coombs <jaraco@jaraco.com>2013-05-11 13:05:32 +0100
commitf0a3905357e596c9a2a85358fda0f41384ff3d39 (patch)
treee505a8f0c09672f73a1c0bdf783433fe70b9312b
parent7adfcead12a21b2ed6b13f5a75477914b524cb12 (diff)
downloadpython-setuptools-git-f0a3905357e596c9a2a85358fda0f41384ff3d39.tar.gz
Fix for yet unpublished issue to ensure that get_resource_filename always re-extracts the content of a temporary filename if it does not match that of the source content.
--HG-- branch : distribute extra : rebase_source : 5605ee258010cde1237db058b770c62264c215e2
-rw-r--r--CHANGES.txt7
-rw-r--r--pkg_resources.py9
2 files changed, 15 insertions, 1 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 6e2b3b28..5d4c13bc 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -3,6 +3,13 @@ CHANGES
=======
------
+0.6.39
+------
+
+* Issue ####: Resources extracted from a zip egg to the file system now also
+ check the contents of the file against the zip contents during each
+ invocation of get_resource_filename.
+
0.6.38
------
diff --git a/pkg_resources.py b/pkg_resources.py
index b59f1703..2ec645d3 100644
--- a/pkg_resources.py
+++ b/pkg_resources.py
@@ -1459,7 +1459,14 @@ class ZipProvider(EggProvider):
if not os.path.isfile(file_path):
return False
stat = os.stat(file_path)
- return stat.st_size==size and stat.st_mtime==timestamp
+ if stat.st_size!=size or stat.st_mtime!=timestamp:
+ return False
+ # check that the contents match
+ zip_contents = self.loader.get_data(zip_path)
+ f = open(file_path, 'rb')
+ file_contents = f.read()
+ f.close()
+ return zip_contents == file_contents
def _get_eager_resources(self):
if self.eagers is None: