#NEWLINE# def find_config_path( dir = None ) : #NEWLINE# #INDENT# "Walk up the dir chain looking for a `.sources` file.\n    \n    @param dir {str} Directory in which to start looking. Defaults\n        to cwd.\n    @raises {RuntimeError} if couldn't find one.\n    " #NEWLINE# d = ( dir or os . getcwd ( ) ) #NEWLINE# next_d = dirname ( d ) #NEWLINE# while ( d != next_d ) : #NEWLINE# #INDENT# p = join ( d , '.sources' ) #NEWLINE# if exists ( p ) : #NEWLINE# #INDENT# return p #NEWLINE# #UNINDENT# d = d #NEWLINE# next_d = dirname ( d ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise RuntimeError ( 'could not find a `.sources` config file' )