Skip to content

Commit

Permalink
Revert "Support MYPY_VERSION for overriding version" (#12333)
Browse files Browse the repository at this point in the history
This reverts commit 3a5b2a9.
  • Loading branch information
JukkaL authored Mar 11, 2022
1 parent 1a0a49a commit 7ee84c7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 21 deletions.
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

0 comments on commit 7ee84c7

Please sign in to comment.