diff --git a/docs/source/conf.py b/docs/source/conf.py index 0c646e1..fb4730e 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -10,6 +10,7 @@ # 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. # +import copy import os from pathlib import Path from m2r import MdInclude @@ -50,6 +51,23 @@ autodoc_typehints = 'description' +# mock missing site packages methods +import site +mock_site_methods = { + # Format: + # method name: return value + 'getusersitepackages': '', + 'getsitepackages': [] +} +__fn = None +for __name, __rval in mock_site_methods.items(): + if not hasattr(site, __name): + __fn = lambda *args, __rval=copy.deepcopy(__rval), **kwargs: __rval + setattr(site, __name, __fn) +del __name +del __rval +del __fn + # Prefix each autosectionlabel with the name of the document it is in and a colon autosectionlabel_prefix_document = True