#NEWLINE# def convert_path( pathname ) : #NEWLINE# #INDENT# "Return 'pathname' as a name that will work on the native filesystem.\n\n    The path is split on '/' and put back together again using the current\n    directory separator.  Needed because filenames in the setup script are\n    always supplied in Unix style, and have to be converted to the local\n    convention before we can actually use them in the filesystem.  Raises\n    ValueError on non-Unix-ish systems if 'pathname' either starts or\n    ends with a slash.\n    " #NEWLINE# if ( os . sep == '/' ) : #NEWLINE# #INDENT# return pathname #NEWLINE# #UNINDENT# if ( not pathname ) : #NEWLINE# #INDENT# return pathname #NEWLINE# #UNINDENT# if ( pathname [ 0 ] == '/' ) : #NEWLINE# #INDENT# raise ValueError ( ( "path '%s' cannot be absolute" % pathname ) ) #NEWLINE# #UNINDENT# if ( pathname [ ( - 1 ) ] == '/' ) : #NEWLINE# #INDENT# raise ValueError ( ( "path '%s' cannot end with '/'" % pathname ) ) #NEWLINE# #UNINDENT# paths = pathname . split ( '/' ) #NEWLINE# while ( os . curdir in paths ) : #NEWLINE# #INDENT# paths . remove ( os . curdir ) #NEWLINE# #UNINDENT# if ( not paths ) : #NEWLINE# #INDENT# return os . curdir #NEWLINE# #UNINDENT# return os . path . join ( * paths )