def each_setup_in_pkg(top_dir):
 for (dir_path, dir_names, filenames) in os.walk(top_dir):
  for fname in filenames:
   if (fname == 'setup.py'):
    with open(os.path.join(dir_path, 'setup.py')) as f:
     (yield (dir_path, f))

def each_setup_in_pkg ( top_dir ) : for ( dir_path , dir_names , filenames ) in os . walk ( top_dir ) : for fname in filenames : if ( fname == 'setup.py' ) : with open ( os . path . join ( dir_path , 'setup.py' ) ) as f : ( yield ( dir_path , f ) )
yield path and file object for each setup .