From d179e77c0084236ac32a23c866889f14e730fa04 Mon Sep 17 00:00:00 2001 From: Joseph Lee Date: Fri, 25 Dec 2020 14:32:42 -0800 Subject: [PATCH 1/3] Dev docs/config: point globalVars.appDir to source directory when building source code dev docs. re #11971. Before building dev docs with Sphinx, config module is imported without NVDA knowing where the app dir is i.e. globalVars.appDir is undefined. Therefore tell Sphinx that globalVars.appDir is source directory so Sphinx can build source code documentation. --- devDocs/conf.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/devDocs/conf.py b/devDocs/conf.py index 06f073db94b..c1a25fbc0d4 100644 --- a/devDocs/conf.py +++ b/devDocs/conf.py @@ -100,6 +100,11 @@ class AppArgs: # autodoc can only mock modules, not objects. from sphinx.ext.autodoc.mock import _make_subclass # noqa: E402 +# #11971: NVDA is not running, therefore app dir is undefined. +# Therefore tell NVDA that apt source directory is app dir. +import globalVars # noqa: E402 +appDir = os.path.join("..", "source") +globalVars.appDir = os.path.abspath(appDir) import config # noqa: E402 # Mock an instance of the configuration manager. config.conf = _make_subclass("conf", "config")() From f33d668f2d29aad01cfc6f72bebd80dca4475527 Mon Sep 17 00:00:00 2001 From: Joseph Lee Date: Fri, 25 Dec 2020 14:33:17 -0800 Subject: [PATCH 2/3] Dev docs/Sphinx config: update copyright header --- devDocs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devDocs/conf.py b/devDocs/conf.py index c1a25fbc0d4..f2fad3a665d 100644 --- a/devDocs/conf.py +++ b/devDocs/conf.py @@ -1,5 +1,5 @@ # A part of NonVisual Desktop Access (NVDA) -# Copyright (C) 2019 NV Access Limited, Leonard de Ruijter +# Copyright (C) 2019-2020 NV Access Limited, Leonard de Ruijter, Joseph Lee # This file is covered by the GNU General Public License. # See the file COPYING for more details. From 1b9e97cace08dc02b22a4d4e81d2fc4996033f5b Mon Sep 17 00:00:00 2001 From: Joseph Lee Date: Sun, 27 Dec 2020 10:47:25 -0800 Subject: [PATCH 3/3] Dev docs/Sphinx config: address review comments. Reviewed by Lukasz Golonka: move globalvars.appDir definition, along with removing duplicate globalVars import statement. --- devDocs/conf.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/devDocs/conf.py b/devDocs/conf.py index f2fad3a665d..b01ee4fd6f2 100644 --- a/devDocs/conf.py +++ b/devDocs/conf.py @@ -16,7 +16,7 @@ import languageHandler # noqa: E402 languageHandler.setLanguage("en") -# Initialize globalvars.appArgs to something sensible. +# Initialize globalVars.appArgs to something sensible. import globalVars # noqa: E402 @@ -30,6 +30,11 @@ class AppArgs: globalVars.appArgs = AppArgs() +# #11971: NVDA is not running, therefore app dir is undefined. +# Therefore tell NVDA that apt source directory is app dir. +appDir = os.path.join("..", "source") +globalVars.appDir = os.path.abspath(appDir) + # Import NVDA's versionInfo module. import versionInfo # noqa: E402 @@ -100,11 +105,6 @@ class AppArgs: # autodoc can only mock modules, not objects. from sphinx.ext.autodoc.mock import _make_subclass # noqa: E402 -# #11971: NVDA is not running, therefore app dir is undefined. -# Therefore tell NVDA that apt source directory is app dir. -import globalVars # noqa: E402 -appDir = os.path.join("..", "source") -globalVars.appDir = os.path.abspath(appDir) import config # noqa: E402 # Mock an instance of the configuration manager. config.conf = _make_subclass("conf", "config")()