summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2020-07-20 17:18:17 (GMT)
committerGitHub <noreply@github.com>2020-07-20 17:18:17 (GMT)
commit94647837d8ebe69e2ddf3a75431f7b8e057930bb (patch)
tree0471cfa91c197b39863cb25dbaa2b80ce077a60b
parentadd7cfc4c63f2ce2e8649906e6c8d902e95d8701 (diff)
downloadcpython-94647837d8ebe69e2ddf3a75431f7b8e057930bb.zip
cpython-94647837d8ebe69e2ddf3a75431f7b8e057930bb.tar.gz
cpython-94647837d8ebe69e2ddf3a75431f7b8e057930bb.tar.bz2
Doc: fix import of asdl.py when called from outside Doc/. (GH-21529) (#21567)
(cherry picked from commit 7f03445d01d5ece41c2ceef7254002e08e8ab5a5) Co-authored-by: Julien Palard <julien@palard.fr>
-rw-r--r--Doc/tools/extensions/asdl_highlight.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Doc/tools/extensions/asdl_highlight.py b/Doc/tools/extensions/asdl_highlight.py
index 7d2ef01..b1989e5 100644
--- a/Doc/tools/extensions/asdl_highlight.py
+++ b/Doc/tools/extensions/asdl_highlight.py
@@ -1,6 +1,9 @@
import os
import sys
-sys.path.append(os.path.abspath("../Parser/"))
+from pathlib import Path
+
+CPYTHON_ROOT = Path(__file__).resolve().parent.parent.parent.parent
+sys.path.append(str(CPYTHON_ROOT / "Parser"))
from pygments.lexer import RegexLexer, bygroups, include, words
from pygments.token import (Comment, Generic, Keyword, Name, Operator,