Describe the bug
When using use_directory_urls: false in mkdocs.yml the build fails with the following error:
INFO - Cleaning site directory
INFO - Building documentation to directory: /Users/dtomlinson/git-repos/projects/tembo/site
Traceback (most recent call last):
File "/Users/dtomlinson/.pyenv/versions/3.8.11/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/shutil.py", line 791, in move
os.rename(src, real_dst)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/dtomlinson/git-repos/projects/tembo/site/coverage/index.html' -> '/Users/dtomlinson/git-repos/projects/tembo/site/coverage/tmp.html'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/dtomlinson/git-repos/projects/tembo/.venv/bin/mkdocs", line 8, in <module>
sys.exit(cli())
File "/Users/dtomlinson/git-repos/projects/tembo/.venv/lib/python3.8/site-packages/click/core.py", line 1128, in __call__
return self.main(*args, **kwargs)
File "/Users/dtomlinson/git-repos/projects/tembo/.venv/lib/python3.8/site-packages/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/Users/dtomlinson/git-repos/projects/tembo/.venv/lib/python3.8/site-packages/click/core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/dtomlinson/git-repos/projects/tembo/.venv/lib/python3.8/site-packages/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/dtomlinson/git-repos/projects/tembo/.venv/lib/python3.8/site-packages/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/Users/dtomlinson/git-repos/projects/tembo/.venv/lib/python3.8/site-packages/mkdocs/__main__.py", line 187, in build_command
build.build(config.load_config(**kwargs), dirty=not clean)
File "/Users/dtomlinson/git-repos/projects/tembo/.venv/lib/python3.8/site-packages/mkdocs/commands/build.py", line 317, in build
config['plugins'].run_event('post_build', config=config)
File "/Users/dtomlinson/git-repos/projects/tembo/.venv/lib/python3.8/site-packages/mkdocs/plugins.py", line 104, in run_event
result = method(**kwargs)
File "/Users/dtomlinson/git-repos/projects/tembo/.venv/lib/python3.8/site-packages/mkdocs_coverage/plugin.py", line 101, in on_post_build
shutil.move(site_coverage_dir / "index.html", site_coverage_dir / "tmp.html")
File "/Users/dtomlinson/.pyenv/versions/3.8.11/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/shutil.py", line 811, in move
copy_function(src, real_dst)
File "/Users/dtomlinson/.pyenv/versions/3.8.11/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/shutil.py", line 435, in copy2
copyfile(src, dst, follow_symlinks=follow_symlinks)
File "/Users/dtomlinson/.pyenv/versions/3.8.11/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/shutil.py", line 264, in copyfile
with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/dtomlinson/git-repos/projects/tembo/site/coverage/index.html'
To Reproduce
Steps to reproduce the behavior:
Set use_directory_urls: false in the mkdocs.yml
Run mkdocs build
See error above
Expected behavior
The error is complaining that ~/git-repos/projects/tembo/site/coverage/index.html does not exist.
coverage.html is copied to the site directory.
When use_directory_urls: false is set I would expect coverage.html to be coverage/index.html to allow an offline build.
Screenshots
N/A
System (please complete the following information):
MkDocs Coverage Plugin version: 0.2.4
Python version: 3.8
OS: Mac OS Big Sur 11.2.1
Additional context
I have no idea how mkdocs works internally, is it possible to for a plugin to get the context from the user's .yml?
If so a check for use_directory_urls: false should move the file to coverage/index.html rather than coverage.html.
Describe the bug When using
use_directory_urls: false
inmkdocs.yml
the build fails with the following error:To Reproduce Steps to reproduce the behavior:
use_directory_urls: false
in themkdocs.yml
mkdocs build
Expected behavior The error is complaining that
~/git-repos/projects/tembo/site/coverage/index.html
does not exist.coverage.html
is copied to thesite
directory.When
use_directory_urls: false
is set I would expectcoverage.html
to becoverage/index.html
to allow an offline build.Screenshots N/A
System (please complete the following information):
MkDocs Coverage Plugin
version: 0.2.4Additional context I have no idea how
mkdocs
works internally, is it possible to for a plugin to get the context from the user's.yml
?If so a check for
use_directory_urls: false
should move the file tocoverage/index.html
rather thancoverage.html
.Thanks 🙂