Skip to content

2024.09.03 release cannot build in a directory that does not exist #177

@SecondSkoll

Description

@SecondSkoll

The new release (2024.09.03) throws an error if the output directory does not exist. It needs to build both the _build and any doctrees directory else it errors out.

Reverting to 2024.04.16 fixes the issue.

Error log below:

. .sphinx/venv/bin/activate; sphinx-autobuild -b dirhtml "." "_build" -c . -d .sphinx/.doctrees -j auto
Traceback (most recent call last):
  File "/home/skoll/git/sphinx-docs-starter-pack/.sphinx/venv/bin/sphinx-autobuild", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/skoll/git/sphinx-docs-starter-pack/.sphinx/venv/lib/python3.12/site-packages/sphinx_autobuild/__main__.py", line 34, in main
    args, build_args = _parse_args(list(argv))
                       ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/skoll/git/sphinx-docs-starter-pack/.sphinx/venv/lib/python3.12/site-packages/sphinx_autobuild/__main__.py", line 101, in _parse_args
    args.outdir = Path(sphinx_args.outputdir).resolve(strict=True)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/pathlib.py", line 1242, in resolve
    s = self._flavour.realpath(self, strict=strict)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen posixpath>", line 435, in realpath
  File "<frozen posixpath>", line 470, in _joinrealpath
FileNotFoundError: [Errno 2] No such file or directory: '_build'

If you then manually create the _build directory:

root@DESKTOP-*:~/test/sphinx-docs-starter-pack# mkdir _build
root@DESKTOP-*:~/test/sphinx-docs-starter-pack# make run
make -f Makefile.sp sp-run
make[1]: Entering directory '/root/test/sphinx-docs-starter-pack'
. .sphinx/venv/bin/activate; sphinx-autobuild -b dirhtml "." "_build" -c . -d .sphinx/.doctrees -j auto
Traceback (most recent call last):
  File "/root/test/sphinx-docs-starter-pack/.sphinx/venv/bin/sphinx-autobuild", line 8, in <module>
    sys.exit(main())
  File "/root/test/sphinx-docs-starter-pack/.sphinx/venv/lib/python3.10/site-packages/sphinx_autobuild/__main__.py", line 34, in main
    args, build_args = _parse_args(list(argv))
  File "/root/test/sphinx-docs-starter-pack/.sphinx/venv/lib/python3.10/site-packages/sphinx_autobuild/__main__.py", line 103, in _parse_args
    args.doctree_dir = Path(sphinx_args.doctreedir).resolve(strict=True)
  File "/root/.pyenv/versions/3.10.7/lib/python3.10/pathlib.py", line 1077, in resolve
    s = self._accessor.realpath(self, strict=strict)
  File "/root/.pyenv/versions/3.10.7/lib/python3.10/posixpath.py", line 395, in realpath
    path, ok = _joinrealpath(filename[:0], filename, strict, {})
  File "/root/.pyenv/versions/3.10.7/lib/python3.10/posixpath.py", line 430, in _joinrealpath
    st = os.lstat(newpath)
FileNotFoundError: [Errno 2] No such file or directory: '.sphinx/.doctrees'
make[1]: *** [Makefile.sp:69: sp-run] Error 1
make[1]: Leaving directory '/root/test/sphinx-docs-starter-pack'
make: *** [Makefile:30: run] Error 2

If I then make the .sphinx/.doctrees directory it works fine:

. .sphinx/venv/bin/activate; sphinx-autobuild -b dirhtml "." "_build" -c . -d .sphinx/.doctrees -j auto
[sphinx-autobuild] Starting initial build
[sphinx-autobuild] > sphinx-build -b dirhtml . _build -c . -d .sphinx/.doctrees -j auto
Running Sphinx v8.0.2
loading translations [en]... done
matplotlib is not installed, social cards will not be generated
myst v4.0.0: MdParserConfig(commonmark_only=False, gfm_only=False, enable_extensions={'substitution', 'linkify', 'deflist'}, disable_syntax=[], all_links_external=False, links_external_new_tab=False, url_schemes=('http', 'https', 'mailto', 'ftp'), ref_domains=None, fence_as_directive=set(), number_code_blocks=[], title_to_header=False, heading_anchors=0, heading_slug_func=None, html_meta={}, footnote_sort=True, footnote_transition=True, words_per_minute=200, substitutions={}, linkify_fuzzy_links=True, dmath_allow_labels=True, dmath_allow_space=True, dmath_allow_digits=True, dmath_double_inline=False, update_mathjax=True, mathjax_classes='tex2jax_process|mathjax_process|math|output_area', enable_checkboxes=False, suppress_warnings=[], highlight_code_blocks=True)
building [mo]: targets for 0 po files that are out of date
writing output...
building [dirhtml]: targets for 2 source files that are out of date
updating environment: [new config] 2 added, 0 changed, 0 removed
reading sources... [100%] readme
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
copying assets...
copying static files... done
copying extra files... done
copying assets: done
/root/test/sphinx-docs-starter-pack/.sphinx/venv/lib/python3.10/site-packages/sphinx_tabs/tabs.py:335: RemovedInSphinx90Warning: The str interface for _JavaScript objects is deprecated. Use js.filename instead.
  if path.suffix == ".js" and path.as_posix() in context["script_files"]:
/root/test/sphinx-docs-starter-pack/.sphinx/venv/lib/python3.10/site-packages/sphinx_tabs/tabs.py:336: RemovedInSphinx90Warning: The str interface for _JavaScript objects is deprecated. Use js.filename instead.
  context["script_files"].remove(path.as_posix())
/root/test/sphinx-docs-starter-pack/.sphinx/venv/lib/python3.10/site-packages/sphinx_tabs/tabs.py:335: RemovedInSphinx90Warning: The str interface for _JavaScript objects is deprecated. Use js.filename instead.
  if path.suffix == ".js" and path.as_posix() in context["script_files"]:
/root/test/sphinx-docs-starter-pack/.sphinx/venv/lib/python3.10/site-packages/sphinx_tabs/tabs.py:336: RemovedInSphinx90Warning: The str interface for _JavaScript objects is deprecated. Use js.filename instead.
  context["script_files"].remove(path.as_posix())
writing output... [100%] readme
generating indices... genindex done
writing additional pages... search done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded.

The HTML pages are in _build.
[sphinx-autobuild] Serving on http://127.0.0.1:8000
[sphinx-autobuild] Waiting to detect changes...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions