#NEWLINE# def unpack_tarball( tar_filename , dest ) : #NEWLINE# #INDENT# print ( ( 'Unpacking %s into %s' % ( os . path . basename ( tar_filename ) , dest ) ) ) #NEWLINE# tar = tarfile . open ( tar_filename ) #NEWLINE# base_dir = None #NEWLINE# for member in tar : #NEWLINE# #INDENT# base_name = member . name . split ( '/' ) [ 0 ] #NEWLINE# if ( base_dir is None ) : #NEWLINE# #INDENT# base_dir = base_name #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( base_dir != base_name ) : #NEWLINE# #INDENT# print ( ( 'Unexpected path in %s: %s' % ( tar_filename , base_name ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# _extractall ( tar , tar ) #NEWLINE# tar . close ( ) #NEWLINE# return os . path . join ( dest , base_dir )