summaryrefslogtreecommitdiff
path: root/sphinx/util/osutil.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2018-04-09 01:46:00 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2018-04-09 01:46:00 +0900
commitb2bd9f75a66bc8979d198453393c565bfd6db6b9 (patch)
tree4d68647ef2de358f8a5579106470c19c2f8dee36 /sphinx/util/osutil.py
parent1dd605971caf6cf50158bd68e088af0030eb5b9b (diff)
parent7e1707000feb43b5ea0d1dffe0c5cb1b9dfc268e (diff)
downloadsphinx-git-b2bd9f75a66bc8979d198453393c565bfd6db6b9.tar.gz
Merge branch '1.7'
Diffstat (limited to 'sphinx/util/osutil.py')
-rw-r--r--sphinx/util/osutil.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/sphinx/util/osutil.py b/sphinx/util/osutil.py
index 21464bbe6..986171293 100644
--- a/sphinx/util/osutil.py
+++ b/sphinx/util/osutil.py
@@ -210,14 +210,21 @@ def ustrftime(format, *args):
return r.encode().decode('unicode-escape')
-def safe_relpath(path, start=None):
+def relpath(path, start=os.curdir):
# type: (unicode, unicode) -> unicode
+ """Return a relative filepath to *path* either from the current directory or
+ from an optional *start* directory.
+
+ This is an alternative of ``os.path.relpath()``. This returns original path
+ if *path* and *start* are on different drives (for Windows platform).
+ """
try:
return os.path.relpath(path, start)
except ValueError:
return path
+safe_relpath = relpath # for compatibility
fs_encoding = sys.getfilesystemencoding() or sys.getdefaultencoding() # type: unicode