#NEWLINE# def _extractall( self , path = '.' , members = None ) : #NEWLINE# #INDENT# "Extract all members from the archive to the current working\n       directory and set owner, modification time and permissions on\n       directories afterwards. `path' specifies a different directory\n       to extract to. `members' is optional and must be a subset of the\n       list returned by getmembers().\n    " #NEWLINE# import copy #NEWLINE# import operator #NEWLINE# from tarfile import ExtractError #NEWLINE# directories = [ ] #NEWLINE# if ( members is None ) : #NEWLINE# #INDENT# members = self #NEWLINE# #UNINDENT# for tarinfo in members : #NEWLINE# #INDENT# if tarinfo . isdir ( ) : #NEWLINE# #INDENT# directories . append ( tarinfo ) #NEWLINE# tarinfo = copy . copy ( tarinfo ) #NEWLINE# tarinfo . mode = 448 #NEWLINE# #UNINDENT# self . extract ( tarinfo , path ) #NEWLINE# #UNINDENT# if ( sys . version_info < ( 2 , 4 ) ) : #NEWLINE# #INDENT# def sorter( dir1 , dir2 ) : #NEWLINE# #INDENT# return cmp ( dir1 . name , dir2 . name ) #NEWLINE# #UNINDENT# directories . sort ( sorter ) #NEWLINE# directories . reverse ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# directories . sort ( key = operator . attrgetter ( 'name' ) , reverse = True ) #NEWLINE# #UNINDENT# for tarinfo in directories : #NEWLINE# #INDENT# dirpath = os . path . join ( path , tarinfo . name ) #NEWLINE# try : #NEWLINE# #INDENT# self . chown ( tarinfo , dirpath ) #NEWLINE# self . utime ( tarinfo , members ) #NEWLINE# self . chmod ( tarinfo , dirpath ) #NEWLINE# #UNINDENT# except ExtractError : #NEWLINE# #INDENT# e = sys . exc_info ( ) [ 1 ] #NEWLINE# if ( self . errorlevel > 1 ) : #NEWLINE# #INDENT# raise #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . _dbg ( 1 , ( 'tarfile: %s' % e ) )