From 379e4831832ed3fe4d778a6e47841ce8ba384486 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Lallement Date: Fri, 5 Jul 2024 09:38:13 +0200 Subject: [PATCH] Missing requirement.txt on RtD build_requirements.py expects requirements.txt to be at the certain location. Since the documentation is in a subdirectory, it is not where build_requirements.py would like it to be (missing ./docs) We build the path of requirements.txt dynamically so it is always in the same directory than the python script. --- docs/.sphinx/build_requirements.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/.sphinx/build_requirements.py b/docs/.sphinx/build_requirements.py index df6f149b4..1a317bb07 100644 --- a/docs/.sphinx/build_requirements.py +++ b/docs/.sphinx/build_requirements.py @@ -1,6 +1,10 @@ import sys +import os + +import pathlib +scriptdir=pathlib.Path(__file__).parent.resolve() +sys.path.append(scriptdir) -sys.path.append('./') from custom_conf import * # The file contains helper functions and the mechanism to build the @@ -113,7 +117,7 @@ def DeduplicateExtensions(extensionNames: [str]): requirements = list(dict.fromkeys(requirements)) requirements.sort() - with open(".sphinx/requirements.txt", 'w') as requirements_file: + with open(os.path.join(scriptdir, "requirements.txt"), 'w') as requirements_file: requirements_file.write( "# DO NOT MODIFY THIS FILE DIRECTLY!\n" "#\n"