[Python-checkins] Doc: fix import of asdl.py when called from outside Doc/. (GH-21529)

Julien Palard webhook-mailer at python.org
Mon Jul 20 03:48:49 EDT 2020


https://github.com/python/cpython/commit/7f03445d01d5ece41c2ceef7254002e08e8ab5a5
commit: 7f03445d01d5ece41c2ceef7254002e08e8ab5a5
branch: master
author: Julien Palard <julien at palard.fr>
committer: GitHub <noreply at github.com>
date: 2020-07-20T09:48:40+02:00
summary:

Doc: fix import of asdl.py when called from outside Doc/. (GH-21529)

files:
M Doc/tools/extensions/asdl_highlight.py

diff --git a/Doc/tools/extensions/asdl_highlight.py b/Doc/tools/extensions/asdl_highlight.py
index 7d2ef011c1b76..b1989e5395707 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,



More information about the Python-checkins mailing list