def get_gitversion() -> dict:
"""
Uses GitVersion (https://github.com/GitTools/GitVersion) to infer project's current version
Returns Gitversion JSON output as a dict
"""
if os.environ.get('APPVEYOR'):
exe = find_executable('gitversion', r'C:\ProgramData\chocolatey\bin')
else:
exe = find_executable('gitversion')
if not exe:
click.secho(
'"gitversion.exe" not been found in your PATH.\n'
'GitVersion is used to infer the current version from the Git repository.\n'
'setuptools_scm plans on switching to using the Semver scheme in the future; when that happens, '
'I\'ll remove the dependency to GitVersion.\n'
'In the meantime, GitVersion can be obtained via Chocolatey (recommended): '
'https://chocolatey.org/packages/GitVersion.Portable\n'
'If you already have chocolatey installed, you can simply run the following command (as admin):\n\n'
'\t\t"choco install gitversion.portable -pre -y"\n\n'
'If you\'re not comfortable using the command line, there is a GUI tool for Chocolatey available at:\n\n'
'\t\thttps://github.com/chocolatey/ChocolateyGUI/releases\n\n'
'Or you can install directly from :\n\n'
'\t\thttps://github.com/GitTools/GitVersion/releases',
err=True,
)
exit(-1)
return loads(subprocess.getoutput([exe]).rstrip())
评论列表
文章目录