jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/842906 )
Change subject: [IMPR] use pathlib.Path to manage sys.path entries in conf.py
......................................................................
[IMPR] use pathlib.Path to manage sys.path entries in conf.py
This adds the pywikibot folder in a canonical way.
Change-Id: I2b13f1d17e02044cee0f810eff795d32c201c4da
---
M docs/conf.py
1 file changed, 4 insertions(+), 7 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/docs/conf.py b/docs/conf.py
index 55fdafc..40f4cfd 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -18,13 +18,13 @@
# If extensions (or modules to document with autodoc) are in another directory,
# 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.
+# documentation root, use Path.resolve() to make it absolute, like shown here.
#
import os
import re
import sys
import warnings
-from os.path import abspath, dirname, join
+from pathlib import Path
# Deprecated classes will generate warnings as Sphinx processes them.
@@ -32,11 +32,8 @@
warnings.simplefilter(action='ignore', category=FutureWarning)
-docs_dir = dirname(__file__)
-repo_dir = abspath(join(docs_dir, '..'))
-sys.path.insert(0, repo_dir + '/pywikibot')
-sys.path.insert(0, repo_dir)
-os.chdir(repo_dir)
+repo_dir = Path(__file__).resolve().parents[1]
+sys.path = [str(repo_dir), str(repo_dir / 'pywikibot')] + sys.path
os.environ['PYWIKIBOT_NO_USER_CONFIG'] = '1'
import pywikibot # noqa: E402
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/842906
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I2b13f1d17e02044cee0f810eff795d32c201c4da
Gerrit-Change-Number: 842906
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged