diff --git a/MANIFEST.in b/MANIFEST.in index 8e6b6386b61f..e8e949f97f26 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,2 @@ -recursive-include lib-typing *.py recursive-include scripts * recursive-exclude scripts myunit diff --git a/build-requirements.txt b/build-requirements.txt new file mode 100644 index 000000000000..0a8547bcc8ef --- /dev/null +++ b/build-requirements.txt @@ -0,0 +1,2 @@ +setuptools +wheel diff --git a/mypy/test/testcmdline.py b/mypy/test/testcmdline.py index a5a888711840..f2ddc9bd429b 100644 --- a/mypy/test/testcmdline.py +++ b/mypy/test/testcmdline.py @@ -15,7 +15,7 @@ from mypy.test.config import test_data_prefix, test_temp_dir from mypy.test.data import parse_test_cases, DataDrivenTestCase from mypy.test.helpers import assert_string_arrays_equal -from mypy.version import __version__ +from mypy.version import __version__, base_version # Path to Python 3 interpreter python3_path = sys.executable @@ -99,5 +99,6 @@ def normalize_file_output(content: List[str], current_abs_path: str) -> List[str timestamp_regex = re.compile('\d{10}') result = [x.replace(current_abs_path, '$PWD') for x in content] result = [x.replace(__version__, '$VERSION') for x in result] + result = [x.replace(base_version, '$VERSION') for x in result] result = [timestamp_regex.sub('$TIMESTAMP', x) for x in result] return result diff --git a/setup.cfg b/setup.cfg index dd46edd3aeff..084dab95b5e1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -20,3 +20,12 @@ parallel = true [coverage:report] show_missing = true + +[metadata] +# This seems to be used only by bdist_wheel. +# You need "pip3 install wheel". +# Then run "python3 setup.py bdist_wheel" to build a wheel file +# (and then upload that to PyPI). +requires-dist = + typed-ast >= 0.6.3 + typing >= 3.5.3; python_version < "3.5" diff --git a/setup.py b/setup.py index 374f76b627ed..722fab858c0c 100644 --- a/setup.py +++ b/setup.py @@ -9,8 +9,11 @@ sys.stderr.write("ERROR: You need Python 3.2 or later to use mypy.\n") exit(1) -from distutils.core import setup -from distutils.command.build_py import build_py +# This requires setuptools when building; setuptools is not needed +# when installing from a wheel file (though it is still neeeded for +# alternative forms of installing, as suggested by README.md). +from setuptools import setup +from setuptools.command.build_py import build_py from mypy.version import base_version from mypy import git @@ -81,18 +84,26 @@ def run(self): 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', 'Topic :: Software Development', ] package_dir = {'mypy': 'mypy'} -if sys.version_info < (3, 5, 0): - package_dir[''] = 'lib-typing/3.2' scripts = ['scripts/mypy', 'scripts/stubgen'] if os.name == 'nt': scripts.append('scripts/mypy.bat') +# These requirements are used when installing by other means than bdist_wheel. +# E.g. "pip3 install ." or +# "pip3 install git+git://github.com/python/mypy.git" +# (as suggested by README.md). +install_requires = [] +install_requires.append('typed-ast >= 0.6.3') +if sys.version_info < (3, 5): + install_requires.append('typing >= 3.5.3') + setup(name='mypy-lang', version=version, description=description, @@ -103,10 +114,11 @@ def run(self): license='MIT License', platforms=['POSIX'], package_dir=package_dir, - py_modules=['typing'] if sys.version_info < (3, 5, 0) else [], + py_modules=[], packages=['mypy'], scripts=scripts, data_files=data_files, classifiers=classifiers, cmdclass={'build_py': CustomPythonBuild}, + install_requires=install_requires, ) diff --git a/test-data/unit/pythoneval.test b/test-data/unit/pythoneval.test index 1887177d3320..7945fe552114 100644 --- a/test-data/unit/pythoneval.test +++ b/test-data/unit/pythoneval.test @@ -11,7 +11,8 @@ print('hello, world') [out] hello, world -[case testAbstractBaseClasses] +-- Skipped because different typing package versions have different repr()s. +[case testAbstractBaseClasses-skip] import re from typing import Sized, Sequence, Iterator, Iterable, Mapping, AbstractSet