Skip to content

Commit 3bf9c9d

Browse files
committed
Fail in setup.py instead
1 parent 17677fc commit 3bf9c9d

2 files changed

Lines changed: 10 additions & 12 deletions

File tree

mypy/build.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,7 @@
4040
TypedDict,
4141
)
4242

43-
try:
44-
from librt.internal import cache_version
45-
except ImportError:
46-
if platform.python_implementation() == "PyPy":
47-
print(
48-
"Running mypy on PyPy is not supported yet."
49-
"To type-check a PyPy library please run mypy on an equivalent CPython version,"
50-
"see https://github.com/mypyc/librt/issues/16 for possible workarounds."
51-
)
52-
sys.exit(2)
53-
else:
54-
raise
43+
from librt.internal import cache_version
5544

5645
import mypy.semanal_main
5746
from mypy.cache import CACHE_VERSION, CacheMeta, ReadBuffer, WriteBuffer, write_json

setup.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,22 @@
55
import glob
66
import os
77
import os.path
8+
import platform
89
import sys
910
from typing import TYPE_CHECKING, Any
1011

1112
if sys.version_info < (3, 10, 0): # noqa: UP036, RUF100
1213
sys.stderr.write("ERROR: You need Python 3.10 or later to use mypy.\n")
1314
exit(1)
1415

16+
if platform.python_implementation() == "PyPy":
17+
print(
18+
"ERROR: Running mypy on PyPy is not supported yet."
19+
"To type-check a PyPy library please use an equivalent CPython version,"
20+
"see https://github.com/mypyc/librt/issues/16 for possible workarounds."
21+
)
22+
sys.exit(1)
23+
1524
# we'll import stuff from the source tree, let's ensure is on the sys path
1625
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)))
1726

0 commit comments

Comments
 (0)