93
def generate_walk_list( full_dir, rel_dir = '' ):
92
def generate_walk_list( full_dir, rel_file = '' ):
94
93
"""Returns a list of files and directories in full_dir, specified as relative
95
94
files (relative to full_dir), breadth first.
100
for file in os.listdir( os.path.join( full_dir, rel_dir ) ):
102
rel_file = os.path.join( rel_dir, file )
103
if rel_file == '.bzr': continue
105
full_file = os.path.join( full_dir, rel_file )
107
if os.path.isfile( full_file ) or os.path.islink( full_file ):
108
ret.append( rel_file )
109
elif os.path.isdir( full_file ):
110
ret.append( rel_file )
111
ret.extend( generate_file_list( full_dir, rel_file ) )
114
'unknown/exotic file: %s' % full_file )
98
if rel_file in { '.bzr', '.stdhome' }: return list()
100
full_file = os.path.join( full_dir, rel_file )
102
# files and links are returned
103
if os.path.isfile( full_file ) or os.path.islink( full_file ):
106
# directories are returned and recursed in to
107
elif os.path.isdir( full_file ):
108
ret = [ rel_file ] if rel_file != '' else []
109
for file in os.listdir( full_file ):
110
ret.extend( Walker.generate_walk_list(
111
full_dir, os.path.join( rel_file, file ) ) )
114
# other kinds are invalid
117
'unknown/exotic file: %s' % full_file )