Incremental GSC parsing (exact copy of the tutorials shared as a separate project) / tqdm / _version.py
1576 views# Definition of the version number1try:2from ._utils import _sh3except: # pragma: no cover4_sh = None56from subprocess import STDOUT7__all__ = ["__version__"]89# major, minor, patch, -extra10version_info = 4, 8, 41112# Nice string for the version13__version__ = '.'.join(map(str, version_info))141516# auto -extra based on commit hash (if not tagged as release)17if (_sh is not None) and (len(version_info) < 4): # pragma: no cover18def commit_hash(*args):19try:20res = _sh('git', 'log', '-n', '1', '--oneline', *args,21stderr=STDOUT).lstrip().split()[0]22return None if res.startswith('fatal') else res23except:24return None2526cur_hash = commit_hash()27if cur_hash is not None:28last_release = commit_hash('v' + __version__)2930if (last_release is None) or (cur_hash not in last_release):31__version__ += '-' + cur_hash323334