Lines Matching refs:path
23 """Contains a substitute for Python 2.6's os.path.relpath()."""
28 # This function is a replacement for os.path.relpath(), which is only
31 # http://docs.python.org/library/os.path.html#os.path.relpath
33 # It should behave essentially the same as os.path.relpath(), except for
35 def relpath(path, start_path, os_path_abspath=None, sep=None):
36 """Return a path relative to the given start path, or None.
38 Returns None if the path is not contained in the directory start_path.
41 path: An absolute or relative path to convert to a relative path.
42 start_path: The path relative to which the given path should be
46 os.path.abspath(). Defaults to os.path.abspath.
47 sep: Path separator. Defaults to os.path.sep
51 os_path_abspath = os.path.abspath
54 # Since os_path_abspath() calls os.path.normpath()--
56 # (see http://docs.python.org/library/os.path.html#os.path.abspath )
61 path = os_path_abspath(path)
63 if not path.lower().startswith(start_path.lower()):
64 # Then path is outside the directory given by start_path.
67 rel_path = path[len(start_path):]
74 # since os.path.normpath() collapses separators, but we use
81 # path = "/tmp/foobar"