dist: get Ubuntu version from dpkg-parsechangelog

This commit is contained in:
Peter F. Patel-Schneider 2022-11-27 09:37:30 -05:00
parent 9b868c8869
commit 4e6f59c2ad
1 changed files with 5 additions and 4 deletions

View File

@ -21,14 +21,15 @@ try: # get commit from git describe
except Exception: # get commit from Ubuntu dpkg-parsechangelog except Exception: # get commit from Ubuntu dpkg-parsechangelog
try: try:
dpkg = subprocess.check_output(['dpkg-parsechangelog'], stderr=subprocess.DEVNULL).strip().decode() dpkg = subprocess.check_output(['dpkg-parsechangelog'], stderr=subprocess.DEVNULL).strip().decode()
print(dpkg) print('DPKG', dpkg)
match = re.search(r'\nVersion: (.*)~', dpkg) match = re.search(r'\nVersion: (.*)~', dpkg)
print('VERSION', match.group(0), match.group(1)) print('VERSION', match.group(0), match.group(1))
with open('lib/solaar/commit', 'w') as vfile: with open('lib/solaar/commit', 'w') as vfile:
vfile.write(f'{match.group[1]}\n') vfile.write(f'{match.group[1]}\n')
commit = subprocess.check_output(['dpkg-parsechangelog', '--show-field', 'Version'], print('Version', subprocess.check_output(['dpkg-parsechangelog', '--show-field', 'Version']).strip().decode())
stderr=subprocess.DEVNULL).strip().decode() print('version', subprocess.check_output(['dpkg-parsechangelog', '--show-field', 'version']).strip().decode())
print('DPKG VERSION', commit) print('Version', subprocess.check_output(['dpkg-parsechangelog', '--show-field=Version']).strip().decode())
print('version', subprocess.check_output(['dpkg-parsechangelog', '--show-field=version']).strip().decode())
# with open('lib/solaar/commit', 'w') as vfile: # with open('lib/solaar/commit', 'w') as vfile:
# vfile.write(f'{commit]}\n') # vfile.write(f'{commit]}\n')
except Exception: except Exception: