dist: get Ubuntu version from dpkg-parsechangelog
This commit is contained in:
parent
c2b4d5a8c8
commit
4a9319a4c0
16
setup.py
16
setup.py
|
@ -1,5 +1,4 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import re
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from glob import glob as _glob
|
from glob import glob as _glob
|
||||||
|
@ -20,18 +19,11 @@ try: # get commit from git describe
|
||||||
vfile.write(f'{commit}\n')
|
vfile.write(f'{commit}\n')
|
||||||
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()
|
version = subprocess.check_output(['dpkg-parsechangelog', '--show-field', 'Version'],
|
||||||
print('DPKG', dpkg)
|
stderr=subprocess.DEVNULL).strip().decode()
|
||||||
match = re.search(r'\nVersion: (.*)~', dpkg)
|
version = version.split('~')
|
||||||
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'{version[0]}\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')
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print('Exception using dpkg-parsechangelog', e)
|
print('Exception using dpkg-parsechangelog', e)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue