#NEWLINE# def relpath( path , start = '.' ) : #NEWLINE# #INDENT# '\n    Work around Python bug #5117, which is not (and will not be) patched in\n    Python 2.6 (http://bugs.python.org/issue5117)\n    ' #NEWLINE# if ( ( sys . version_info < ( 2 , 7 ) ) and ( 'posix' in sys . builtin_module_names ) ) : #NEWLINE# #INDENT# if ( not path ) : #NEWLINE# #INDENT# raise ValueError ( 'no path specified' ) #NEWLINE# #UNINDENT# start_list = [ x for x in os . path . abspath ( start ) . split ( os . path . sep ) if x ] #NEWLINE# path_list = [ x for x in os . path . abspath ( path ) . split ( os . path . sep ) if x ] #NEWLINE# i = len ( os . path . commonprefix ( [ start_list , path_list ] ) ) #NEWLINE# rel_list = ( ( [ os . path . pardir ] * ( len ( start_list ) - i ) ) + path_list [ i : ] ) #NEWLINE# if ( not rel_list ) : #NEWLINE# #INDENT# return os . path . curdir #NEWLINE# #UNINDENT# return os . path . join ( * rel_list ) #NEWLINE# #UNINDENT# return os . path . relpath ( path , start = start )