File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change 1+ from _version import __version__
Original file line number Diff line number Diff line change 1+ import os , subprocess
2+ worktree = os .path .dirname (os .path .abspath (__file__ ))
3+ gitdir = worktree + '/.git/'
4+ try :
5+ __version__ = subprocess .check_output (
6+ 'git --git-dir=' + gitdir + ' --work-tree=' +
7+ worktree + ' describe --long --dirty --abbrev=10 --tags' , shell = True )
8+ __version__ = __version__ .rstrip () # remove trailing \n
9+ __version__ = __version__ [1 :] # remove leading v
10+ # remove commit hash to conform to PEP440:
11+ split_ = __version__ .split ('-' )
12+ __version__ = split_ [0 ]
13+ if split_ [1 ] != '0' :
14+ __version__ += '.' + split_ [1 ]
15+ except :
16+ __version__ = '(no git available to determine version)'
You can’t perform that action at this time.
0 commit comments