diff options
| author | Georg Brandl <georg@python.org> | 2011-09-21 19:06:48 +0200 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2011-09-21 19:06:48 +0200 |
| commit | 0e55d4967fa9c2f9d2abc09ffa9fad357c47bf16 (patch) | |
| tree | 09a687be29fa46249bcec80531a7ed7e9f0bfe32 /sphinx/util | |
| parent | aba7fcb1fa5ffdf5af225c3e7e78a4710a5a942d (diff) | |
| download | sphinx-0e55d4967fa9c2f9d2abc09ffa9fad357c47bf16.tar.gz | |
Fix #765: on Windows, relpath() does not always succeed.
Diffstat (limited to 'sphinx/util')
| -rw-r--r-- | sphinx/util/osutil.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sphinx/util/osutil.py b/sphinx/util/osutil.py index b7a12cda..b07fa6ab 100644 --- a/sphinx/util/osutil.py +++ b/sphinx/util/osutil.py @@ -133,3 +133,10 @@ if sys.version_info < (3, 0): .decode('utf-8') else: ustrftime = time.strftime + + +def safe_relpath(path, start=None): + try: + return os.path.relpath(path, start) + except ValueError: + return path |
