dist: get Ubuntu version from dpkg-parsechangelog

This commit is contained in:
Peter F. Patel-Schneider 2022-11-28 11:39:45 -05:00
parent 4a9319a4c0
commit f4b25b2594
1 changed files with 4 additions and 4 deletions

View File

@ -19,11 +19,11 @@ try: # get commit from git describe
vfile.write(f'{commit}\n')
except Exception: # get commit from Ubuntu dpkg-parsechangelog
try:
version = subprocess.check_output(['dpkg-parsechangelog', '--show-field', 'Version'],
stderr=subprocess.DEVNULL).strip().decode()
version = version.split('~')
commit = subprocess.check_output(['dpkg-parsechangelog', '--show-field', 'Version'],
stderr=subprocess.DEVNULL).strip().decode()
commit = commit.split('~')
with open('lib/solaar/commit', 'w') as vfile:
vfile.write(f'{version[0]}\n')
vfile.write(f'{commit[0]}\n')
except Exception as e:
print('Exception using dpkg-parsechangelog', e)