Skip to content

Commit 964a175

Browse files
committed
Revert "Support invoking mypy from setuptools"
This reverts commit 7e42ac8.
1 parent 6877b44 commit 964a175

File tree

3 files changed

+1
-55
lines changed

3 files changed

+1
-55
lines changed

mypy/build.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,6 @@ def default_data_dir(bin_dir: str) -> str:
203203
# TODO fix this logic
204204
if not bin_dir:
205205
# Default to directory containing this file's parent.
206-
grandparent_dir = os.path.dirname(os.path.dirname(__file__))
207-
# Running from within an egg, likely from setuptools.
208-
if grandparent_dir.endswith('.egg'):
209-
return os.path.join(grandparent_dir, 'lib', 'mypy')
210206
return os.path.dirname(os.path.dirname(__file__))
211207
base = os.path.basename(bin_dir)
212208
dir = os.path.dirname(bin_dir)

mypy/main.py

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,11 @@
22

33
import os
44
import os.path
5-
import shlex
65
import shutil
76
import subprocess
87
import sys
98
import tempfile
109

11-
import setuptools as setuptools # type: ignore
12-
1310
import typing
1411
from typing import Dict, List, Tuple
1512

@@ -34,45 +31,6 @@ def __init__(self) -> None:
3431
self.dirty_stubs = False
3532

3633

37-
class MyPyCommand(setuptools.Command):
38-
"""The :class:`MyPyCommand` class is used by setuptools to perform
39-
type checks on registered modules.
40-
"""
41-
42-
description = "Validate PEP 0484 Types with mypy"
43-
user_options = [
44-
('mypy-args=', None, 'Arguments to pass through to mypy')
45-
] # type: List[tuple]
46-
47-
def initialize_options(self):
48-
self.mypy_args = ''
49-
50-
def finalize_options(self):
51-
pass
52-
53-
def run(self):
54-
try:
55-
mypy_options = []
56-
for package in sorted(set(self.distribution.packages)):
57-
mypy_options.append('--package')
58-
mypy_options.append(package)
59-
mypy_options.extend(shlex.split(self.mypy_args))
60-
sources, options = process_options(mypy_options)
61-
# If the user has requested to use the python_path during analysis,
62-
# fetch all required eggs (This will also add them to sys.path).
63-
# This will ensure mypy behaves as if the package were installed
64-
# globally without having to globally install it to modify
65-
# PYTHONPATH
66-
if options.python_path and self.distribution.install_requires:
67-
self.distribution.fetch_build_eggs(
68-
self.distribution.install_requires)
69-
type_check_only(sources, None, options)
70-
except CompileError as e:
71-
for m in e.messages:
72-
sys.stderr.write(m + '\n')
73-
sys.exit(1)
74-
75-
7634
def main(script_path: str) -> None:
7735
"""Main entry point to the type checker.
7836

setup.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import os.path
66
import sys
77

8-
from setuptools import setup
8+
from distutils.core import setup
99
from mypy.version import __version__
1010
from mypy import git
1111

@@ -69,13 +69,6 @@ def find_data_files(base, globs):
6969
'Topic :: Software Development',
7070
]
7171

72-
entry_points = {
73-
'distutils.commands': [
74-
'mypy = mypy.main:MyPyCommand'
75-
]
76-
}
77-
78-
7972
setup(name='mypy-lang',
8073
version=version,
8174
description=description,
@@ -91,5 +84,4 @@ def find_data_files(base, globs):
9184
scripts=['scripts/mypy', 'scripts/stubgen'],
9285
data_files=data_files,
9386
classifiers=classifiers,
94-
entry_points=entry_points,
9587
)

0 commit comments

Comments
 (0)