Skip to contentSkip to conversation

doc: Use sys.path.append for pytests being found

PATCH New Tom Rini 1 participant 1 message Mar 9 Kbuild

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/1 doc: Use sys.path.append for pytests being found

Rather than having our "docs" build tagets modify PTYHONPATH, have doc/conf.py append the required paths at runtime instead. This will ensure that our builds from readthedocs will also find all of the required files.

---
Cc: Heinrich Schuchardt <[email protected]>

Currently this is empy for example:
https://docs.u-boot.org/en/latest/develop/pytest/test_bind.html
But with these changes:
https://u-boot--903.org.readthedocs.build/en/903/develop/pytest/test_bind.html

---
 Makefile    | 3 +--
 doc/conf.py | 2 ++
 2 files changed, 3 insertions(+), 2 deletions(-)
Makefile +1 -2
index 5df869213b63..88543808ff58 100644
@@ -2759,8 +2759,7 @@ DOC_TARGETS := xmldocs latexdocs pdfdocs htmldocs epubdocs cleandocs \
 	       linkcheckdocs dochelp refcheckdocs texinfodocs infodocs
 PHONY += $(DOC_TARGETS)
 $(DOC_TARGETS): scripts_basic FORCE
-	$(Q)PYTHONPATH=$(srctree)/test/py/tests:$(srctree)/test/py \
-	$(MAKE) $(build)=doc $@
+	$(Q)$(MAKE) $(build)=doc $@
 
 PHONY += checkstack ubootrelease ubootversion
 
doc/conf.py +2 -0
index 84d028feda83..bf60fe14315a 100644
@@ -34,6 +34,8 @@ if os.environ.get("READTHEDOCS", "") == "True":
 # 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.
 sys.path.insert(0, os.path.abspath('sphinx'))
+sys.path.append(os.path.abspath('../test/py/tests'))
+sys.path.append(os.path.abspath('../test/py'))
 from load_config import loadConfig
 
 # -- General configuration ------------------------------------------------
Signature · 1 line
2.43.0