Updates for issue #486 and #461:

When requesting version using master, it would report the previous released version.
It would also report the SHA of the GIT repository it was currently executing in.

Both of these issues make it unclear which version of VSG you are using.

This update provides

  1)  Defaulting version to 'master'
  2)  Defaulting SHA to NA

The goal will be to hardcode the version and SHA when releasing to PYPI.
This commit is contained in:
Jeremiah Leary 2020-12-05 11:01:12 -06:00
parent a7c7dda433
commit 2579a5a0e7
1 changed files with 5 additions and 14 deletions

View File

@ -1,22 +1,13 @@
version = '2.0.0'
import subprocess
sVersion = 'master'
sShaNum = 'NA'
def print_version(oCommandLineArguments):
if (oCommandLineArguments.version):
print('VHDL Style Guide (VSG) version ' + str(version))
print('VHDL Style Guide (VSG) version: ' + str(sVersion))
print(retrieve_git_sha())
print(f'Git commit SHA: {sShaNum}')
exit(0)
def retrieve_git_sha():
try:
sShaNum = subprocess.check_output(['git', 'log', '--pretty=%h', '-n', '1'], stderr=subprocess.STDOUT)
sShaNum = sShaNum.decode('utf-8').strip()
return f'Git commit SHA: {sShaNum}'
except subprocess.CalledProcessError:
return ''