aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pkg_resources.py10
-rwxr-xr-xpkg_resources.txt3
2 files changed, 8 insertions, 5 deletions
diff --git a/pkg_resources.py b/pkg_resources.py
index e43201d4..e03e104d 100644
--- a/pkg_resources.py
+++ b/pkg_resources.py
@@ -1071,7 +1071,6 @@ class ZipProvider(EggProvider):
manager, os.path.join(zip_path, name)
)
return os.path.dirname(last) # return the extracted directory name
-
zip_stat = self.zipinfo[zip_path]
t,d,size = zip_stat[5], zip_stat[6], zip_stat[3]
date_time = (
@@ -1080,21 +1079,18 @@ class ZipProvider(EggProvider):
)
timestamp = time.mktime(date_time)
real_path = manager.get_cache_path(self.egg_name, self._parts(zip_path))
-
if os.path.isfile(real_path):
stat = os.stat(real_path)
if stat.st_size==size and stat.st_mtime==timestamp:
# size and stamp match, don't bother extracting
return real_path
-
from tempfile import mkstemp
outf, tmpnam = mkstemp(".$extract", dir=os.path.dirname(real_path))
os.write(outf, self.loader.get_data(zip_path))
os.close(outf)
os.utime(tmpnam, (timestamp,timestamp))
manager.postprocess(tmpnam, real_path)
- try:
- os.rename(tmpnam, real_path)
+ try: os.rename(tmpnam, real_path)
except os.error:
if os.path.isfile(real_path):
stat = os.stat(real_path)
@@ -1102,6 +1098,10 @@ class ZipProvider(EggProvider):
# size and stamp match, somebody did it just ahead of us
# so we're done
return real_path
+ elif os.name=='nt': # Windows, delete old file and retry
+ os.unlink(real_path)
+ os.rename(tmpnam, real_path)
+ return real_path
raise
return real_path
diff --git a/pkg_resources.txt b/pkg_resources.txt
index 1f3e47fe..a2bcf381 100755
--- a/pkg_resources.txt
+++ b/pkg_resources.txt
@@ -1503,6 +1503,9 @@ Release Notes/Change History
depender's preferences to override those of a dependee, to prevent conflicts
when a lower version is acceptable to the dependee, but not the depender.
+ * Fixed a problem extracting zipped files on Windows, when the egg in question
+ has had changed contents but still has the same version number.
+
0.6a4
* Fix a bug in ``WorkingSet.resolve()`` that was introduced in 0.6a3.