From 19ddcc3232d2d02b2933eacde3f722c7da73ca6d Mon Sep 17 00:00:00 2001 From: Andre Sailer Date: Wed, 9 Dec 2020 14:39:29 +0100 Subject: [PATCH] Docs: RTD: fix path to DIRAC source code --- docs/diracdoctools/Utilities.py | 9 +++++---- docs/source/conf.py | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/diracdoctools/Utilities.py b/docs/diracdoctools/Utilities.py index 1a2d80f0205..a76312b5679 100644 --- a/docs/diracdoctools/Utilities.py +++ b/docs/diracdoctools/Utilities.py @@ -69,16 +69,17 @@ def writeLinesToFile(filename, lines): LOG.debug('Not updating file content for %s', os.path.join(os.getcwd(), filename)) -def setUpReadTheDocsEnvironment(moduleName='DIRAC'): +def setUpReadTheDocsEnvironment(moduleName='DIRAC', location='../../'): """Create the necessary links and environment variables to create documentation inside readthedocs. Ensure that ``moduleName`` is in the PYTHONPATH by creating a link pointing to the basefolder of the source code. :param str moduleName: name of the base source code module, default 'DIRAC' + :param str location: Path to the location where the module can be found relative to the 'conf.py'. Default '../../' """ LOG.info('Running for READTHEDOCS') sys.path.append(os.path.abspath('.')) - diracPath = os.path.abspath(os.path.join(os.getcwd(), '../src')) + diracPath = os.path.abspath(os.path.join(os.getcwd(), location)) LOG.info('Path To Module(?): %r', diracPath) buildfolder = '_build' @@ -86,13 +87,13 @@ def setUpReadTheDocsEnvironment(moduleName='DIRAC'): # We need to have the moduleName somewhere, or we cannot import it, as # readtheDocs clones the repo into something based on the branchname - if not os.path.exists(os.path.join('../src', moduleName)): + if not os.path.exists(os.path.join(location, moduleName)): diracLink = os.path.abspath(os.path.join(os.getcwd(), '../', buildfolder, moduleName)) LOG.info('Link: %r', diracLink) if not os.path.exists(diracLink): LOG.info('Creating symbolic link %r -> %r', diracPath, diracLink) os.symlink(diracPath, diracLink) - diracPath = os.path.abspath(os.path.join(diracLink, 'src')) + diracPath = os.path.abspath(os.path.join(diracLink, '..')) sys.path.insert(0, diracPath) diff --git a/docs/source/conf.py b/docs/source/conf.py index fe576261206..e6ce4aacb26 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -50,7 +50,7 @@ # AUTO SETUP START if os.environ.get('READTHEDOCS') == 'True': - setUpReadTheDocsEnvironment(moduleName='DIRAC') + setUpReadTheDocsEnvironment(moduleName='DIRAC', location='../../src') # re-create the RST files for the command references LOG.info('Building command reference')