diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2021-03-06 18:30:43 +0300 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2021-03-19 19:32:47 +0300 |
commit | a19250b46e039fc9a49b38883b90f5d7959a383f (patch) | |
tree | 0f07fadcb592338ba52e963a1a5550f17be55a9e /sphinx/environment | |
parent | 4f8cb861e3b29186b38248fe81e4944fd987fcce (diff) |
Fix #8959: using UNIX path separator confuses Sphinx on Windows
The first element of env.relfn2path() should be a POSIX path, not a OS
dependent path.
Diffstat (limited to 'sphinx/environment')
-rw-r--r-- | sphinx/environment/__init__.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sphinx/environment/__init__.py b/sphinx/environment/__init__.py index af3e2b8d5..6b2acab9f 100644 --- a/sphinx/environment/__init__.py +++ b/sphinx/environment/__init__.py @@ -10,7 +10,6 @@ import os import pickle -import posixpath import warnings from collections import defaultdict from copy import copy @@ -34,6 +33,7 @@ from sphinx.util import DownloadFiles, FilenameUniqDict, logging from sphinx.util.docutils import LoggingReporter from sphinx.util.i18n import CatalogRepository, docname_to_domain from sphinx.util.nodes import is_translatable +from sphinx.util.osutil import canon_path, os_path if False: # For type annotation @@ -351,6 +351,7 @@ class BuildEnvironment: source dir, while relative filenames are relative to the dir of the containing document. """ + filename = os_path(filename) if filename.startswith('/') or filename.startswith(os.sep): rel_fn = filename[1:] else: @@ -358,7 +359,7 @@ class BuildEnvironment: base=None)) rel_fn = path.join(docdir, filename) - return (posixpath.normpath(rel_fn), + return (canon_path(path.normpath(rel_fn)), path.normpath(path.join(self.srcdir, rel_fn))) @property |