diff --git a/mypy/main.py b/mypy/main.py index 94957a2ad101..3d44499a13d3 100644 --- a/mypy/main.py +++ b/mypy/main.py @@ -4,6 +4,7 @@ import argparse import os +import platform import subprocess import sys import time @@ -40,6 +41,13 @@ if TYPE_CHECKING: from _typeshed import SupportsWrite +if platform.python_implementation() == "PyPy": + sys.stderr.write( + "ERROR: Running mypy on PyPy is not supported yet.\n" + "To type-check a PyPy library please use an equivalent CPython version,\n" + "see https://github.com/mypyc/librt/issues/16 for possible workarounds.\n" + ) + sys.exit(2) orig_stat: Final = os.stat MEM_PROFILE: Final = False # If True, dump memory profile diff --git a/setup.py b/setup.py index bc45d90354e5..2892bdc64f38 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,6 @@ import glob import os import os.path -import platform import sys from typing import TYPE_CHECKING, Any @@ -13,14 +12,6 @@ sys.stderr.write("ERROR: You need Python 3.10 or later to use mypy.\n") exit(1) -if platform.python_implementation() == "PyPy": - sys.stderr.write( - "ERROR: Running mypy on PyPy is not supported yet.\n" - "To type-check a PyPy library please use an equivalent CPython version,\n" - "see https://github.com/mypyc/librt/issues/16 for possible workarounds.\n" - ) - exit(1) - # we'll import stuff from the source tree, let's ensure is on the sys path sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)))