[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.
This commit is contained in:
+3
-3
@@ -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 -----------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user