You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Only change is to add in pathlib.Path(rel_fn).as_posix() to ensure that the window path looks like a posix path.
defrelfn2path(self, filename: str, docname: str=None) ->Tuple[str, str]:
"""Return paths to a file referenced from a document, relative to documentation root and absolute. In the input "filename", absolute filenames are taken as relative to the source dir, while relative filenames are relative to the dir of the containing document. """iffilename.startswith('/') orfilename.startswith(os.sep):
rel_fn=filename[1:]
else:
docdir=path.dirname(self.doc2path(docnameorself.docname,
base=None))
rel_fn=path.join(docdir, filename)
return (posixpath.normpath(pathlib.Path(rel_fn).as_posix()),
path.normpath(path.join(self.srcdir, rel_fn)))
bashtage
changed the title
BUG: posixpath.normal path returns invalid path
BUG: posixpath.normal path returns invalid path on Windows
Mar 19, 2021
Describe the bug
The use of posixpath.normalpath
in
breaks windows builds when the source and build directory are not nested.
The reason this happen is that
path.join
inserts windows seperators that posixpath doesn't understand.To Reproduce
Any project with a structure like
doc/ doc/source/conf.py doc/build/ <build dir>
breaks since this fix assumes that build is under source.
Heading into the function,
rel_fn
has a value likeThis needs to be converted to
which is the correct location but
is instead converted to
which is wrong.
Expected behavior
Get the correct path on windows so docs can build
Your project
https://github.com/bashtage/arch/tree/main/doc
Fix
The fix is to replace
posixpath.normpath(rel_fn)
with
The text was updated successfully, but these errors were encountered: