Skip to content

Commit

Permalink
Merge pull request #10068 from tk0miya/10057_scanning_docs_on_root
Browse files Browse the repository at this point in the history
Fix #10057: Failed to scan documents on the root directory
  • Loading branch information
tk0miya committed Jan 11, 2022
2 parents 9a42e42 + ce99cd4 commit 3ed9265
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGES
Expand Up @@ -72,6 +72,8 @@ Bugs fixed
at info-field-list
* #9390: texinfo: Do not emit labels inside footnotes
* #9979: Error level messages were displayed as warning messages
* #10057: Failed to scan documents if the project is placed onto the root
directory

Testing
--------
Expand Down
5 changes: 3 additions & 2 deletions sphinx/util/__init__.py
Expand Up @@ -72,10 +72,11 @@ def get_matching_files(dirname: str,
"""
# dirname is a normalized absolute path.
dirname = path.normpath(path.abspath(dirname))
dirlen = len(dirname) + 1 # exclude final os.path.sep

for root, dirs, files in os.walk(dirname, followlinks=True):
relativeroot = root[dirlen:]
relativeroot = path.relpath(root, dirname)
if relativeroot == ".":
relativeroot = "" # suppress dirname for files on the target dir

qdirs = enumerate(path_stabilize(path.join(relativeroot, dn))
for dn in dirs) # type: Iterable[Tuple[int, str]]
Expand Down

0 comments on commit 3ed9265

Please sign in to comment.