Skip to content

[FW][IMP] conf.py: strip module path from upgrade utils #13525

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

Open
wants to merge 1 commit into
base: 17.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,16 @@ def source_read_replace(app, docname, source):
result = result.replace(f"{{{key}}}", app.config.source_read_replace_vals[key])
source[0] = result

def upgrade_util_signature_rewrite(app, domain, objtype, contentnode):
# Same as add_module_names=False but **only** for odoo.upgrade.util functions or classes
signature = contentnode.parent[0]
if objtype == 'function' and signature.astext().startswith('odoo.upgrade.util.'):
# <odoo.upgrade.util.modules>, <modules_installed>, <(cr, *modules)>
signature.pop(0)
if objtype == 'class' and signature.astext().startswith('class odoo.upgrade.util.'):
# <class >, <odoo.upgrade.util.pg.>, <PGRegexp>
signature.pop(1)

def setup(app):
# Generate all alternate URLs for each document
app.add_config_value('project_root', None, 'env')
Expand All @@ -393,6 +403,7 @@ def setup(app):
app.add_config_value('is_remote_build', None, 'env') # Whether the build is remotely deployed
app.add_config_value('source_read_replace_vals', {}, 'env')
app.connect('source-read', source_read_replace)
app.connect('object-description-transform', upgrade_util_signature_rewrite)
# TODO uncomment after moving to >= v7.2.5 to also substitute placeholders in included files.
# See https://github.com/sphinx-doc/sphinx/commit/ff1831
# app.connect('include-read', source_read_replace)
Expand Down