[Python-checkins] r67719 - in python/branches/py3k: Lib/tarfile.py Lib/test/test_tarfile.py Misc/NEWS
lars.gustaebel
python-checkins at python.org
Fri Dec 12 15:58:39 CET 2008
Author: lars.gustaebel
Date: Fri Dec 12 15:58:38 2008
New Revision: 67719
Log:
Merged revisions 67717 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r67717 | lars.gustaebel | 2008-12-12 14:58:03 +0100 (Fri, 12 Dec 2008) | 2 lines
Issue #4616: TarFile.utime(): Restore directory times on Windows.
........
Modified:
python/branches/py3k/ (props changed)
python/branches/py3k/Lib/tarfile.py
python/branches/py3k/Lib/test/test_tarfile.py
python/branches/py3k/Misc/NEWS
Modified: python/branches/py3k/Lib/tarfile.py
==============================================================================
--- python/branches/py3k/Lib/tarfile.py (original)
+++ python/branches/py3k/Lib/tarfile.py Fri Dec 12 15:58:38 2008
@@ -2265,10 +2265,6 @@
"""
if not hasattr(os, 'utime'):
return
- if sys.platform == "win32" and tarinfo.isdir():
- # According to msdn.microsoft.com, it is an error (EACCES)
- # to use utime() on directories.
- return
try:
os.utime(targetpath, (tarinfo.mtime, tarinfo.mtime))
except EnvironmentError as e:
Modified: python/branches/py3k/Lib/test/test_tarfile.py
==============================================================================
--- python/branches/py3k/Lib/test/test_tarfile.py (original)
+++ python/branches/py3k/Lib/test/test_tarfile.py Fri Dec 12 15:58:38 2008
@@ -255,17 +255,14 @@
def test_extractall(self):
# Test if extractall() correctly restores directory permissions
# and times (see issue1735).
- if sys.platform == "win32":
- # Win32 has no support for utime() on directories or
- # fine grained permissions.
- return
-
tar = tarfile.open(tarname, encoding="iso8859-1")
directories = [t for t in tar if t.isdir()]
tar.extractall(TEMPDIR, directories)
for tarinfo in directories:
path = os.path.join(TEMPDIR, tarinfo.name)
- self.assertEqual(tarinfo.mode & 0o777, os.stat(path).st_mode & 0o777)
+ if sys.platform != "win32":
+ # Win32 has no support for fine grained permissions.
+ self.assertEqual(tarinfo.mode & 0o777, os.stat(path).st_mode & 0o777)
self.assertEqual(tarinfo.mtime, os.path.getmtime(path))
tar.close()
Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS (original)
+++ python/branches/py3k/Misc/NEWS Fri Dec 12 15:58:38 2008
@@ -45,6 +45,8 @@
Library
-------
+- Issue #4616: TarFile.utime(): Restore directory times on Windows.
+
- Issue #4021: tokenize.detect_encoding() now raises a SyntaxError when the
codec cannot be found. This is for compatibility with the builtin behavior.
More information about the Python-checkins
mailing list