Skip to content

Commit

Permalink
Revert "Support next types-setuptools update (python#14781)"
Browse files Browse the repository at this point in the history
This reverts commit ab7b69a.
  • Loading branch information
AlexWaygood committed Feb 26, 2023
1 parent ab7b69a commit 2245b42
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
10 changes: 2 additions & 8 deletions mypyc/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import re
import sys
import time
from typing import TYPE_CHECKING, Any, Dict, Iterable, NoReturn, Union, cast
from typing import TYPE_CHECKING, Any, Dict, Iterable, NoReturn, cast

from mypy.build import BuildSource
from mypy.errors import CompileError
Expand All @@ -41,13 +41,7 @@
from mypyc.options import CompilerOptions

if TYPE_CHECKING:
from distutils.core import Extension as _distutils_Extension
from typing_extensions import TypeAlias

from setuptools import Extension as _setuptools_Extension

Extension: TypeAlias = Union[_setuptools_Extension, _distutils_Extension]

from distutils.core import Extension

try:
# Import setuptools so that it monkey-patch overrides distutils
Expand Down
12 changes: 1 addition & 11 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import os
import os.path
import sys
from typing import TYPE_CHECKING, Any

if sys.version_info < (3, 7, 0):
sys.stderr.write("ERROR: You need Python 3.7 or later to use mypy.\n")
Expand All @@ -18,14 +17,11 @@
# This requires setuptools when building; setuptools is not needed
# when installing from a wheel file (though it is still needed for
# alternative forms of installing, as suggested by README.md).
from setuptools import Extension, find_packages, setup
from setuptools import find_packages, setup
from setuptools.command.build_py import build_py

from mypy.version import __version__ as version

if TYPE_CHECKING:
from typing_extensions import TypeGuard

description = "Optional static typing for Python"
long_description = """
Mypy -- Optional Static Typing for Python
Expand All @@ -40,10 +36,6 @@
""".lstrip()


def is_list_of_setuptools_extension(items: list[Any]) -> TypeGuard[list[Extension]]:
return all(isinstance(item, Extension) for item in items)


def find_package_data(base, globs, root="mypy"):
"""Find all interesting data files, for setup(package_data=)
Expand Down Expand Up @@ -174,8 +166,6 @@ def run(self):
# our Appveyor builds run out of memory sometimes.
multi_file=sys.platform == "win32" or force_multifile,
)
assert is_list_of_setuptools_extension(ext_modules), "Expected mypycify to use setuptools"

else:
ext_modules = []

Expand Down

0 comments on commit 2245b42

Please sign in to comment.