executablebooks / sphinx-external-toc

A sphinx extension that allows the site-map to be defined in a single YAML file
https://sphinx-external-toc.readthedocs.io
MIT License
32 stars 18 forks source link

Sphinx gettext using external TOC fails #71

Closed scotboyd closed 2 years ago

scotboyd commented 2 years ago

Describe the bug

context Running make gettext or sphinx-build -b gettext results in a crash every time. The same crash occurs as long as there is at least one non-root entry in the TOC. It always fails on the last file - if you have 100's of files, it will complete 99% and then crash.

expectation Running gettext should not crash when using external TOC. I've tried different machines with different Sphinx configs and narrowed it down to a very small repro case.

bug

Exception occurred:
  File "/usr/local/lib/python3.9/site-packages/sphinx/util/osutil.py", line 55, in canon_path
    return nativepath.replace(path.sep, SEP)
AttributeError: 'NoneType' object has no attribute 'replace'

problem If you look at the traceback, it appears to occur here:

File "/usr/local/lib/python3.9/site-packages/sphinx/templates/gettext/message.pot_t", line 21, in top-level template code

You can work around this by turning off gettext_location.

Reproduce the bug

TOC:

root: test
entries: 
 - file: test2.rst

Test.rst:

 Test case for gettext
=====================

Lorem Ipsum

Test2.rst:

Test case for gettext
=====================

Lorem Ipsum

conf.py:

extensions = [ 
  "sphinx_external_toc"
]

external_toc_path = "ardk_toc.yml"
external_toc_exclude_missing = True

sphinx-err-plgr3qru.log

List your environment

# Sphinx version: 3.5.3
# Python version: 3.9.4 (CPython)
# Docutils version: 0.17 release
# Jinja2 version: 2.11.3
welcome[bot] commented 2 years ago

Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:

chrisjsewell commented 2 years ago

Heya, can you post the full traceback thanks

scotboyd commented 2 years ago

Did the attachment under the repro category not work? I'm seeing the log there

chrisjsewell commented 2 years ago

oh yeh sorry I missed that

chrisjsewell commented 2 years ago

Heya, fixed in https://github.com/executablebooks/sphinx-external-toc/commit/e3b8c1ce53fad8cf822ab079e08300b0f0d862a3