[Python-checkins] python/nondist/sandbox/setuptools pkg_resources.py, 1.75, 1.76 pkg_resources.txt, 1.18, 1.19
pje@users.sourceforge.net
pje at users.sourceforge.net
Sat Oct 22 21:07:48 CEST 2005
Update of /cvsroot/python/python/nondist/sandbox/setuptools
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23380
Modified Files:
pkg_resources.py pkg_resources.txt
Log Message:
Fixed a problem extracting zipped files on Windows, when the egg in
question has had changed contents but still has the same version number.
Index: pkg_resources.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/pkg_resources.py,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -d -r1.75 -r1.76
--- pkg_resources.py 18 Oct 2005 04:08:45 -0000 1.75
+++ pkg_resources.py 22 Oct 2005 19:07:44 -0000 1.76
@@ -1071,7 +1071,6 @@
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 @@
)
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 @@
# 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
Index: pkg_resources.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/pkg_resources.txt,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- pkg_resources.txt 18 Oct 2005 04:08:45 -0000 1.18
+++ pkg_resources.txt 22 Oct 2005 19:07:44 -0000 1.19
@@ -1503,6 +1503,9 @@
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.
More information about the Python-checkins
mailing list