OCA / oca-addons-repo-template

OCA Repository Template
MIT License
61 stars 89 forks source link

Failed automatic README generation #268

Open SirAionTech opened 2 months ago

SirAionTech commented 2 months ago

Describe the bug

When pre-commit executes the hook oca-gen-addon-readme, the following occurs:

Generate addons README files from fragments..............................Failed
- hook id: oca-gen-addon-readme
- exit code: 1

Traceback (most recent call last):
  File "/home/simone/.cache/pre-commit/repovulpicmx/py_env-python3/bin/oca-gen-addon-readme", line 8, in <module>
    sys.exit(gen_addon_readme())
  File "/home/simone/.cache/pre-commit/repovulpicmx/py_env-python3/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/home/simone/.cache/pre-commit/repovulpicmx/py_env-python3/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/home/simone/.cache/pre-commit/repovulpicmx/py_env-python3/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/simone/.cache/pre-commit/repovulpicmx/py_env-python3/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/home/simone/.cache/pre-commit/repovulpicmx/py_env-python3/lib/python3.10/site-packages/tools/gen_addon_readme.py", line 564, in gen_addon_readme
    gen_one_addon_readme(
  File "/home/simone/.cache/pre-commit/repovulpicmx/py_env-python3/lib/python3.10/site-packages/tools/gen_addon_readme.py", line 376, in gen_one_addon_readme
    with open(template_filename, "r", encoding="utf8") as tf:
FileNotFoundError: [Errno 2] No such file or directory: '/home/simone/.cache/pre-commit/repovulpicmx/py_env-python3/lib/python3.10/site-packages/tools/gen_addon_readme.rst.jinja'

To Reproduce

Steps to reproduce the behavior:

  1. pipx install pre-commit
  2. git clone git@github.com:OCA/server-tools.git && cd server-tools Right now the repository is https://github.com/OCA/server-tools/tree/5577e14e231a7907c8869dcb638fd34178b6d8af
  3. pre-commit install
  4. Edit any file that generates the README (for instance attachment_queue/readme/DESCRIPTION.rst)
  5. git commit --all

Expected behavior The README is generated

Additional context There has been some discussion about this but I can't find it anymore, this is similar to https://github.com/acsone/setuptools-odoo/issues/55.

I'm opening the issue here instead of https://github.com/OCA/maintainer-tools because installing the package as described there ($ pipx install oca-maintainers-tools@git+https://github.com/OCA/maintainer-tools.git) allows to generate the readme correctly, so the problem might be with how the template tells pre-commit to install the package.