From f7e1f0645e93adb2eb78c383ac9bf9fbae80315c Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 5 Feb 2019 11:59:06 +0000 Subject: [PATCH] [IMP] doc: PYTHONPATH configuration Previously we'd `append` the extensions and odoo parent directories to sys.path, however this means if an `odoo` is already installed in a sys.path (e.g. global installation, or setup.py develop in a venv, ...) *that* will be used as the source of Python code (for autodoc) instead of the Python source being synchronised with the rst, which can lead to very odd behaviour. Prepend the doc's stuff to the PYTHONPATH instead, to ensure they get priority and the code matching the rst gets loaded. --- doc/conf.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index 3563433ff9d..0390c443e15 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -6,11 +6,11 @@ import sphinx # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. DIR = os.path.dirname(__file__) -sys.path.append( +sys.path.insert(0, os.path.abspath( os.path.join(DIR, '_extensions'))) -# autodoc -sys.path.append(os.path.abspath(os.path.join(DIR, '..'))) +# put current odoo's source on PYTHONPATH for autodoc +sys.path.insert(0, os.path.abspath(os.path.join(DIR, '..'))) # -- General configuration -----------------------------------------------------