#NEWLINE# def make_tar( tfn , source_dirs , ignore_path = [ ] ) : #NEWLINE# #INDENT# '\n    Make a zip file `fn` from the contents of source_dis.\n    ' #NEWLINE# def select( fn ) : #NEWLINE# #INDENT# rfn = realpath ( fn ) #NEWLINE# for p in ignore_path : #NEWLINE# #INDENT# if p . endswith ( '/' ) : #NEWLINE# #INDENT# p = p [ : ( - 1 ) ] #NEWLINE# #UNINDENT# if rfn . startswith ( p ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# #UNINDENT# if ( rfn in python_files ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# return ( not is_blacklist ( fn ) ) #NEWLINE# #UNINDENT# files = [ ] #NEWLINE# for sd in source_dirs : #NEWLINE# #INDENT# sd = realpath ( sd ) #NEWLINE# compile_dir ( sd ) #NEWLINE# files += [ ( x , relpath ( realpath ( x ) , sd ) ) for x in listfiles ( sd ) if select ( x ) ] #NEWLINE# #UNINDENT# tf = tarfile . open ( dn , 'w:gz' , format = tarfile . USTAR_FORMAT ) #NEWLINE# dirs = [ ] #NEWLINE# for ( fn , afn ) in files : #NEWLINE# #INDENT# dn = dirname ( afn ) #NEWLINE# if ( dn not in dirs ) : #NEWLINE# #INDENT# d = '' #NEWLINE# for component in split ( dn ) : #NEWLINE# #INDENT# d = join ( d , component ) #NEWLINE# if d . startswith ( '/' ) : #NEWLINE# #INDENT# d = d [ 1 : ] #NEWLINE# #UNINDENT# if ( ( d == '' ) or ( d in dirs ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# dirs . append ( d ) #NEWLINE# tinfo = tarfile . TarInfo ( d ) #NEWLINE# tinfo . type = tarfile . DIRTYPE #NEWLINE# tf . addfile ( tinfo ) #NEWLINE# #UNINDENT# #UNINDENT# tf . add ( fn , afn ) #NEWLINE# #UNINDENT# tf . close ( )