diff --git a/setup.py b/setup.py index 578bae81..57a1972e 100755 --- a/setup.py +++ b/setup.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -import re import subprocess from glob import glob as _glob @@ -20,18 +19,11 @@ try: # get commit from git describe vfile.write(f'{commit}\n') except Exception: # get commit from Ubuntu dpkg-parsechangelog try: - dpkg = subprocess.check_output(['dpkg-parsechangelog'], stderr=subprocess.DEVNULL).strip().decode() - print('DPKG', dpkg) - match = re.search(r'\nVersion: (.*)~', dpkg) - print('VERSION', match.group(0), match.group(1)) + version = subprocess.check_output(['dpkg-parsechangelog', '--show-field', 'Version'], + stderr=subprocess.DEVNULL).strip().decode() + version = version.split('~') with open('lib/solaar/commit', 'w') as vfile: - vfile.write(f'{match.group(1)}\n') - print('Version', subprocess.check_output(['dpkg-parsechangelog', '--show-field', 'Version']).strip().decode()) - print('version', subprocess.check_output(['dpkg-parsechangelog', '--show-field', 'version']).strip().decode()) - 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: - # vfile.write(f'{commit]}\n') + vfile.write(f'{version[0]}\n') except Exception as e: print('Exception using dpkg-parsechangelog', e)