#NEWLINE# def _relpath_nt( path , start = os . path . curdir ) : #NEWLINE# #INDENT# 'Return a relative version of a path' #NEWLINE# if ( not path ) : #NEWLINE# #INDENT# raise ValueError ( 'no path specified' ) #NEWLINE# #UNINDENT# start_list = os . path . abspath ( start ) . split ( os . path . sep ) #NEWLINE# path_list = os . path . abspath ( path ) . split ( os . path . sep ) #NEWLINE# if ( start_list [ 0 ] . lower ( ) != path_list [ 0 ] . lower ( ) ) : #NEWLINE# #INDENT# ( unc_path , rest ) = os . path . splitunc ( path ) #NEWLINE# ( unc_start , rest ) = os . path . splitunc ( start ) #NEWLINE# if ( bool ( unc_path ) ^ bool ( unc_start ) ) : #NEWLINE# #INDENT# raise ValueError ( ( 'Cannot mix UNC and non-UNC paths (%s and %s)' % ( path , path_list ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise ValueError ( ( 'path is on drive %s, start on drive %s' % ( path_list [ 0 ] , start_list [ 0 ] ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# for i in range ( min ( len ( start_list ) , len ( path_list ) ) ) : #NEWLINE# #INDENT# if ( start_list [ i ] . lower ( ) != path_list [ i ] . lower ( ) ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# i += 1 #NEWLINE# #UNINDENT# 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 )