]> 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:58:38 +0000 (14:58 +0000)
committerLars Gustäbel <lars@gustaebel.de>
Fri, 12 Dec 2008 14:58:38 +0000 (14:58 +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 222b43371985fcd7657aca5c650709a8a2945535..be7daf14c37fcb5bf0d4a2e19a4360e4fccb9e04 100644 (file)
@@ -2265,10 +2265,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 as e:
index 1f9e092440925f22d0b32e1164f7ef2d92277e6c..affbeeb6c2acf999bff77fd827459649914ce7a9 100644 (file)
@@ -255,17 +255,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 & 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()
 
index 6568a1c5a38766abd48c240a945dc8a2c18980b4..aaa65c587e40c2ff533bf2ae1b018c6b1ca0eab7 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -45,6 +45,8 @@ Core and Builtins
 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.