From 9b868c886960c73aa1cd7fc1cbd55345f53e1d2e Mon Sep 17 00:00:00 2001 From: "Peter F. Patel-Schneider" Date: Sat, 26 Nov 2022 23:56:56 -0500 Subject: [PATCH] dist: get Ubuntu version from dpkg-parsechangelog --- setup.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/setup.py b/setup.py index b331d773..588ba335 100755 --- a/setup.py +++ b/setup.py @@ -16,7 +16,6 @@ with open('lib/solaar/version', 'r') as vfile: try: # get commit from git describe commit = subprocess.check_output(['git', 'describe', '--always'], stderr=subprocess.DEVNULL).strip().decode() - print('GIT', commit) with open('lib/solaar/commit', 'w') as vfile: vfile.write(f'{commit}\n') except Exception: # get commit from Ubuntu dpkg-parsechangelog @@ -24,14 +23,14 @@ except Exception: # get commit from Ubuntu dpkg-parsechangelog dpkg = subprocess.check_output(['dpkg-parsechangelog'], stderr=subprocess.DEVNULL).strip().decode() print(dpkg) match = re.search(r'\nVersion: (.*)~', dpkg) - print(match.group(1)) + print('VERSION', match.group(0), match.group(1)) with open('lib/solaar/commit', 'w') as vfile: vfile.write(f'{match.group[1]}\n') - print( - 'DPKG VERSION', - subprocess.check_output(['dpkg-parsechangelog', '--show-field', 'Version'], - stderr=subprocess.DEVNULL).strip().decode() - ) + commit = subprocess.check_output(['dpkg-parsechangelog', '--show-field', 'Version'], + stderr=subprocess.DEVNULL).strip().decode() + print('DPKG VERSION', commit) + # with open('lib/solaar/commit', 'w') as vfile: + # vfile.write(f'{commit]}\n') except Exception: pass