summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Palard <julien@palard.fr>2020-07-20 09:48:40 +0200
committerGitHub <noreply@github.com>2020-07-20 09:48:40 +0200
commit7f03445d01d5ece41c2ceef7254002e08e8ab5a5 (patch)
treea243401ef103b7ae98d48e5a0805900219072d77
parent7cf1cb36ecafabff363790d245f809d3894fbbaf (diff)
downloadcpython-git-7f03445d01d5ece41c2ceef7254002e08e8ab5a5.tar.gz
Doc: fix import of asdl.py when called from outside Doc/. (GH-21529)
-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 7d2ef011c1..b1989e5395 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,