Skip to content

4.1.1+ breaks when used with techdocs-core #173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
timo-reymann opened this issue Mar 14, 2025 · 3 comments · Fixed by #174
Closed

4.1.1+ breaks when used with techdocs-core #173

timo-reymann opened this issue Mar 14, 2025 · 3 comments · Fixed by #174
Labels
bug Something isn't working

Comments

@timo-reymann
Copy link
Contributor

Foremost, thanks for your great work on the plugin!

It seems like with 4.1.1+ the plugin breaks compatibility with techdocs-core, which internally enables the monorepo plugin.

As far as I can tell this has been introduced with #168

Stack Trace

The following stack trace appears:

verbose: DEBUG   -  Running `files` event from plugin 'git-revision-date-localized'
verbose: Traceback (most recent call last):
  File "/usr/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/usr/lib/python3.12/site-packages/click/core.py", line 1161, in __call__
verbose: return self.main(*args, **kwargs)
verbose: ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/click/core.py", line 1082, in main
verbose: rv = self.invoke(ctx)
verbose: ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/click/core.py", line 1697, in invoke
verbose: return _process_result(sub_ctx.command.invoke(sub_ctx))
verbose: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/click/core.py", line 1443, in invoke
verbose: return ctx.invoke(self.callback, **ctx.params)
verbose: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/click/core.py", line 788, in invoke
verbose: return __callback(*args, **kwargs)
verbose: ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/mkdocs/__main__.py", line 288, in build_command
    build.build(cfg, dirty=not clean)
  File "/usr/lib/python3.12/site-packages/mkdocs/commands/build.py", line 292, in build
verbose: files = config.plugins.on_files(files, config=config)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/mkdocs/plugins.py", line 593, in on_files
verbose: return self.run_event('files', files, config=config)
verbose: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/mkdocs/plugins.py", line 566, in run_event
verbose: result = method(item, **kwargs)
verbose: ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/mkdocs_git_revision_date_localized_plugin/plugin.py", line 188, in on_files
verbose: original_source = config.get("plugins").get("monorepo").merger.files_source_dir
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
verbose: AttributeError: 'NoneType' object has no attribute 'files_source_dir'
Failed to generate docs from /builds/xxx into /builds/xxy/site; caused by unknown error 'Command mkdocs failed, exit code: 1'

Proposed fix

# Support monorepo/techdocs, which copies the docs_dir to a temporary directory
- if "monorepo" in config.get("plugins", {}):
+ if "monorepo" in config.get("plugins", {}) and config.get("plugins").get("monorepo").merger is not None:
  original_source = config.get("plugins").get("monorepo").merger.files_source_dir
else:
  original_source = None

Also happy to create a tiny PR for this :)

@timvink
Copy link
Owner

timvink commented Mar 14, 2025

Thanks for finding and reporting this! Yes, small PR would be appreciated, I'll then release it soon.

@timvink timvink added the bug Something isn't working label Mar 14, 2025
@timvink
Copy link
Owner

timvink commented Mar 14, 2025

Released to pypi; thanks again!

https://github.com/timvink/mkdocs-git-revision-date-localized-plugin/releases/tag/v1.4.5

@timo-reymann
Copy link
Contributor Author

That was fast, thank you 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants