File tree Expand file tree Collapse file tree 2 files changed +12
-11
lines changed
Tools/peg_generator/pegen Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Original file line number Diff line number Diff line change 1111import token
1212import traceback
1313
14- from typing import Final
15-
16- from pegen .build import build_parser_and_generator
17- from pegen .testutil import print_memstats
18-
1914
2015argparser = argparse .ArgumentParser (
2116 prog = "pegen" , description = "Experimental PEG-like parser generator"
5247
5348
5449def main () -> None :
50+ from pegen .build import build_parser_and_generator
51+ from pegen .testutil import print_memstats
52+
5553 args = argparser .parse_args ()
5654 verbose = args .verbose
5755 verbose_tokenizer = verbose >= 3
@@ -133,4 +131,7 @@ def main() -> None:
133131
134132
135133if __name__ == "__main__" :
134+ if sys .version_info < (3 , 8 ):
135+ print ("ERROR: using pegen requires at least Python 3.8!" , file = sys .stderr )
136+ sys .exit (1 )
136137 main ()
Original file line number Diff line number Diff line change 66
77from typing import Optional , Tuple
88
9- import distutils .log
10- from distutils .core import Distribution , Extension
11- from distutils .command .clean import clean # type: ignore
12- from distutils .command .build_ext import build_ext # type: ignore
13- from distutils .tests .support import fixup_build_ext
14-
159from pegen .c_generator import CParserGenerator
1610from pegen .grammar import Grammar
1711from pegen .grammar_parser import GeneratedParser as GrammarParser
@@ -47,6 +41,12 @@ def compile_c_extension(
4741 If *build_dir* is provided, that path will be used as the temporary build directory
4842 of distutils (this is useful in case you want to use a temporary directory).
4943 """
44+ import distutils .log
45+ from distutils .core import Distribution , Extension
46+ from distutils .command .clean import clean # type: ignore
47+ from distutils .command .build_ext import build_ext # type: ignore
48+ from distutils .tests .support import fixup_build_ext
49+
5050 if verbose :
5151 distutils .log .set_verbosity (distutils .log .DEBUG )
5252
You can’t perform that action at this time.
0 commit comments