8000 bpo-40334: Allow to run make regen-pegen without distutils by pablogsal · Pull Request #19684 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-40334: Allow to run make regen-pegen without distutils #19684

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions Tools/peg_generator/pegen/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@
import token
import traceback

from typing import Final

from pegen.build import build_parser_and_generator
from pegen.testutil import print_memstats


argparser = argparse.ArgumentParser(
prog="pegen", description="Experimental PEG-like parser generator"
Expand Down Expand Up @@ -52,6 +47,9 @@


def main() -> None:
from pegen.build import build_parser_and_generator
from pegen.testutil import print_memstats

args = argparser.parse_args()
verbose = args.verbose
verbose_tokenizer = verbose >= 3
Expand Down Expand Up @@ -133,4 +131,7 @@ def main() -> None:


if __name__ == "__main__":
if sys.version_info < (3, 8):
print("ERROR: using pegen requires at least Python 3.8!", file=sys.stderr)
sys.exit(1)
main()
12 changes: 6 additions & 6 deletions Tools/peg_generator/pegen/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@

from typing import Optional, Tuple

import distutils.log
from distutils.core import Distribution, Extension
from distutils.command.clean import clean # type: ignore
from distutils.command.build_ext import build_ext # type: ignore
from distutils.tests.support import fixup_build_ext

from pegen.c_generator import CParserGenerator
from pegen.grammar import Grammar
from pegen.grammar_parser import GeneratedParser as GrammarParser
Expand Down Expand Up @@ -47,6 +41,12 @@ def compile_c_extension(
If *build_dir* is provided, that path will be used as the temporary build directory
of distutils (this is useful in case you want to use a temporary directory).
"""
import distutils.log
from distutils.core import Distribution, Extension
from distutils.command.clean import clean # type: ignore
from distutils.command.build_ext import build_ext # type: ignore
from distutils.tests.support import fixup_build_ext

if verbose:
distutils.log.set_verbosity(distutils.log.DEBUG)

Expand Down
0