[Python-checkins] python/dist/src/Lib tarfile.py,1.3,1.4

jackjansen@users.sourceforge.net jackjansen@users.sourceforge.net
Fri, 07 Mar 2003 04:47:09 -0800


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv10715

Modified Files:
	tarfile.py 
Log Message:
Test that os.utime and os.chmod actually exist before using them.

Index: tarfile.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/tarfile.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** tarfile.py	19 Feb 2003 12:51:34 -0000	1.3
--- tarfile.py	7 Mar 2003 12:47:06 -0000	1.4
***************
*** 1514,1525 ****
          """Set file permissions of targetpath according to tarinfo.
          """
!         try:
!             os.chmod(targetpath, tarinfo.mode)
!         except EnvironmentError, e:
!             raise ExtractError, "could not change mode"
  
      def utime(self, tarinfo, targetpath):
          """Set modification time of targetpath according to tarinfo.
          """
          if sys.platform == "win32" and tarinfo.isdir():
              # According to msdn.microsoft.com, it is an error (EACCES)
--- 1514,1528 ----
          """Set file permissions of targetpath according to tarinfo.
          """
!         if hasattr(os, 'chmod'):
!             try:
!                 os.chmod(targetpath, tarinfo.mode)
!             except EnvironmentError, e:
!                 raise ExtractError, "could not change mode"
  
      def utime(self, tarinfo, targetpath):
          """Set modification time of targetpath according to tarinfo.
          """
+         if not hasattr(os, 'utime'):
+ 	    return
          if sys.platform == "win32" and tarinfo.isdir():
              # According to msdn.microsoft.com, it is an error (EACCES)