Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Support MYPY_VERSION for overriding version" #12333

Merged
merged 1 commit into from
Mar 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 8 additions & 18 deletions mypy/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,12 @@
# - Release versions have the form "0.NNN".
# - Dev versions have the form "0.NNN+dev" (PLUS sign to conform to PEP 440).
# - For 1.0 we'll switch back to 1.2.3 form.
base_version = '0.950+dev'
# Overridden by setup.py
__version__ = base_version
__version__ = '0.950+dev'
base_version = __version__


def setup_compute_version() -> str:
# We allow an environment variable to override version, but we should probably
# enforce that it is consistent with the existing version minus additional information.
if "MYPY_VERSION" in os.environ:
assert os.environ["MYPY_VERSION"].startswith(base_version)
return os.environ["MYPY_VERSION"]

mypy_dir = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
if base_version.endswith('+dev') and git.is_git_repo(mypy_dir) and git.have_git():
version = base_version + '.' + git.git_revision(mypy_dir).decode('utf-8')
if git.is_dirty(mypy_dir):
return version + ".dirty"
return version
return base_version
mypy_dir = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
if __version__.endswith('+dev') and git.is_git_repo(mypy_dir) and git.have_git():
__version__ += '.' + git.git_revision(mypy_dir).decode('utf-8')
if git.is_dirty(mypy_dir):
__version__ += '.dirty'
del mypy_dir
4 changes: 1 addition & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# alternative forms of installing, as suggested by README.md).
from setuptools import setup, find_packages
from setuptools.command.build_py import build_py
from mypy.version import setup_compute_version
from mypy.version import __version__ as version

description = 'Optional static typing for Python'
long_description = '''
Expand All @@ -32,8 +32,6 @@
types.
'''.lstrip()

version = setup_compute_version()


def find_package_data(base, globs, root='mypy'):
"""Find all interesting data files, for setup(package_data=)
Expand Down