File tree 2 files changed +11
-14
lines changed
2 files changed +11
-14
lines changed Original file line number Diff line number Diff line change
1
+ import os
2
+ from mypy import git
3
+
1
4
__version__ = '0.4.6-dev'
5
+
6
+ mypy_dir = os .path .abspath (os .path .dirname (os .path .dirname (__file__ )))
7
+ if git .is_git_repo (mypy_dir ) and git .have_git ():
8
+ __version__ += '-' + git .git_revision (mypy_dir ).decode ('utf-8' )
9
+ if git .is_dirty (mypy_dir ):
10
+ __version__ += '-dirty'
11
+ del mypy_dir
Original file line number Diff line number Diff line change 31
31
''' .lstrip ()
32
32
33
33
34
- def cache_version_id ():
35
- """Returns the version id to use for the incremental hash.
36
-
37
- If setup.py is run from a git repo, the git commit hash will be
38
- included if possible. If not, then this function will fall back to
39
- using the default version id from mypy/version.py."""
40
- if git .is_git_repo ('.' ) and git .have_git ():
41
- return __version__ + '-' + git .git_revision ('.' ).decode ('utf-8' )
42
- else :
43
- # Default fallback
44
- return __version__
45
-
46
-
47
34
def find_data_files (base , globs ):
48
35
"""Find all interesting data files, for setup(data_files=)
49
36
@@ -71,7 +58,7 @@ def pin_version(self):
71
58
path = os .path .join (self .build_lib , 'mypy' )
72
59
self .mkpath (path )
73
60
with open (os .path .join (path , 'version.py' ), 'w' ) as stream :
74
- stream .write ('__version__ = "{}"\n ' .format (cache_version_id () ))
61
+ stream .write ('__version__ = "{}"\n ' .format (version ))
75
62
76
63
def run (self ):
77
64
self .execute (self .pin_version , ())
You can’t perform that action at this time.
0 commit comments