diff --git a/mypy/build.py b/mypy/build.py index e618d74266f4..5022c7a76f9e 100644 --- a/mypy/build.py +++ b/mypy/build.py @@ -203,10 +203,6 @@ def default_data_dir(bin_dir: str) -> str: # TODO fix this logic if not bin_dir: # Default to directory containing this file's parent. - grandparent_dir = os.path.dirname(os.path.dirname(__file__)) - # Running from within an egg, likely from setuptools. - if grandparent_dir.endswith('.egg'): - return os.path.join(grandparent_dir, 'lib', 'mypy') return os.path.dirname(os.path.dirname(__file__)) base = os.path.basename(bin_dir) dir = os.path.dirname(bin_dir) diff --git a/mypy/main.py b/mypy/main.py index 1c2541c26155..45d209088108 100644 --- a/mypy/main.py +++ b/mypy/main.py @@ -2,14 +2,11 @@ import os import os.path -import shlex import shutil import subprocess import sys import tempfile -import setuptools as setuptools # type: ignore - import typing from typing import Dict, List, Tuple @@ -34,45 +31,6 @@ def __init__(self) -> None: self.dirty_stubs = False -class MyPyCommand(setuptools.Command): - """The :class:`MyPyCommand` class is used by setuptools to perform - type checks on registered modules. - """ - - description = "Validate PEP 0484 Types with mypy" - user_options = [ - ('mypy-args=', None, 'Arguments to pass through to mypy') - ] # type: List[tuple] - - def initialize_options(self): - self.mypy_args = '' - - def finalize_options(self): - pass - - def run(self): - try: - mypy_options = [] - for package in sorted(set(self.distribution.packages)): - mypy_options.append('--package') - mypy_options.append(package) - mypy_options.extend(shlex.split(self.mypy_args)) - sources, options = process_options(mypy_options) - # If the user has requested to use the python_path during analysis, - # fetch all required eggs (This will also add them to sys.path). - # This will ensure mypy behaves as if the package were installed - # globally without having to globally install it to modify - # PYTHONPATH - if options.python_path and self.distribution.install_requires: - self.distribution.fetch_build_eggs( - self.distribution.install_requires) - type_check_only(sources, None, options) - except CompileError as e: - for m in e.messages: - sys.stderr.write(m + '\n') - sys.exit(1) - - def main(script_path: str) -> None: """Main entry point to the type checker. diff --git a/setup.py b/setup.py index b55bb629fcb6..7ac47a751903 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ import os.path import sys -from setuptools import setup +from distutils.core import setup from mypy.version import __version__ from mypy import git @@ -69,13 +69,6 @@ def find_data_files(base, globs): 'Topic :: Software Development', ] -entry_points = { - 'distutils.commands': [ - 'mypy = mypy.main:MyPyCommand' - ] -} - - setup(name='mypy-lang', version=version, description=description, @@ -91,5 +84,4 @@ def find_data_files(base, globs): scripts=['scripts/mypy', 'scripts/stubgen'], data_files=data_files, classifiers=classifiers, - entry_points=entry_points, )