]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Merged revisions 67717 via svnmerge from
authorLars Gustäbel <lars@gustaebel.de>
Fri, 12 Dec 2008 14:14:42 +0000 (14:14 +0000)
committerLars Gustäbel <lars@gustaebel.de>
Fri, 12 Dec 2008 14:14:42 +0000 (14:14 +0000)
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.
........

Lib/tarfile.py
Lib/test/test_tarfile.py
Misc/NEWS

index ab74cc59253aa07e49d5e0a7941b15e736487d8b..b678185c2e3f08fa0845a92b656cd8ef69b6c661 100644 (file)
@@ -2284,10 +2284,6 @@ class TarFile(object):
         """
         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, e:
index 7e4fd25cf04bc3002b7155ddf53d7124f29118db..f5c9ed434e00d0bbc8ac131fc0aa8cf80235c16d 100644 (file)
@@ -256,17 +256,14 @@ class MiscReadTest(ReadTest):
     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 & 0777, os.stat(path).st_mode & 0777)
+            if sys.platform != "win32":
+                # Win32 has no support for fine grained permissions.
+                self.assertEqual(tarinfo.mode & 0777, os.stat(path).st_mode & 0777)
             self.assertEqual(tarinfo.mtime, os.path.getmtime(path))
         tar.close()
 
index 93b69143cb823448f4e8c192681b9a606c5a47d5..f65578f90f1a1971639d535b71d11be87c770b3c 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -32,6 +32,8 @@ Core and Builtins
 Library
 -------
 
+- Issue #4616: TarFile.utime(): Restore directory times on Windows.
+
 - Issue #4483: _dbm module now builds on systems with gdbm & gdbm_compat
   libs.