File tree 2 files changed +21
-9
lines changed
2 files changed +21
-9
lines changed Original file line number Diff line number Diff line change 5
5
# - Release versions have the form "0.NNN".
6
6
# - Dev versions have the form "0.NNN+dev" (PLUS sign to conform to PEP 440).
7
7
# - For 1.0 we'll switch back to 1.2.3 form.
8
- __version__ = '0.950+dev'
9
- base_version = __version__
8
+ base_version = '0.950+dev'
9
+ # Overridden by setup.py
10
+ __version__ = base_version
10
11
11
- mypy_dir = os .path .abspath (os .path .dirname (os .path .dirname (__file__ )))
12
- if __version__ .endswith ('+dev' ) and git .is_git_repo (mypy_dir ) and git .have_git ():
13
- __version__ += '.' + git .git_revision (mypy_dir ).decode ('utf-8' )
14
- if git .is_dirty (mypy_dir ):
15
- __version__ += '.dirty'
16
- del mypy_dir
12
+
13
+ def setup_compute_version () -> str :
14
+ # We allow an environment variable to override version, but we should probably
15
+ # enforce that it is consistent with the existing version minus additional information.
16
+ if "MYPY_VERSION" in os .environ :
17
+ assert os .environ ["MYPY_VERSION" ].startswith (base_version )
18
+ return os .environ ["MYPY_VERSION" ]
19
+
20
+ mypy_dir = os .path .abspath (os .path .dirname (os .path .dirname (__file__ )))
21
+ if base_version .endswith ('+dev' ) and git .is_git_repo (mypy_dir ) and git .have_git ():
22
+ version = base_version + '.' + git .git_revision (mypy_dir ).decode ('utf-8' )
23
+ if git .is_dirty (mypy_dir ):
24
+ return version + ".dirty"
25
+ return version
26
+ return base_version
Original file line number Diff line number Diff line change 17
17
# alternative forms of installing, as suggested by README.md).
18
18
from setuptools import setup , find_packages
19
19
from setuptools .command .build_py import build_py
20
- from mypy .version import __version__ as version
20
+ from mypy .version import setup_compute_version
21
21
22
22
description = 'Optional static typing for Python'
23
23
long_description = '''
32
32
types.
33
33
''' .lstrip ()
34
34
35
+ version = setup_compute_version ()
36
+
35
37
36
38
def find_package_data (base , globs , root = 'mypy' ):
37
39
"""Find all interesting data files, for setup(package_data=)
You can’t perform that action at this time.
0 commit comments