dist: get Ubuntu version from dpkg-parsechangelog
This commit is contained in:
parent
a6461d6a6e
commit
b73030a0f1
30
setup.py
30
setup.py
|
@ -1,8 +1,6 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import os
|
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
|
||||||
|
|
||||||
from glob import glob as _glob
|
from glob import glob as _glob
|
||||||
|
|
||||||
|
@ -16,24 +14,26 @@ NAME = 'Solaar'
|
||||||
with open('lib/solaar/version', 'r') as vfile:
|
with open('lib/solaar/version', 'r') as vfile:
|
||||||
version = vfile.read().strip()
|
version = vfile.read().strip()
|
||||||
|
|
||||||
try:
|
try: # get commit from git describe
|
||||||
commit = subprocess.check_output(['git', 'describe', '--always'], stderr=subprocess.DEVNULL).strip().decode()
|
commit = subprocess.check_output(['git', 'describe', '--always'], stderr=subprocess.DEVNULL).strip().decode()
|
||||||
print('GIT', commit)
|
print('GIT', commit)
|
||||||
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: # get commit from Ubuntu PPA directory name
|
except Exception: # get commit from Ubuntu dpkg-parsechangelog
|
||||||
dir = os.path.basename(sys.path[0])
|
try:
|
||||||
print('DIRECTORY', sys.path[0], dir, os.getcwd())
|
dpkg = subprocess.check_output(['dpkg-parsechangelog'], stderr=subprocess.DEVNULL).strip().decode()
|
||||||
commit_match = re.search(r'git[0-9]*-([0-9a-f]*)~', dir)
|
print(dpkg)
|
||||||
if commit_match:
|
match = re.search(r'\nVersion: (.*)~', dpkg)
|
||||||
|
print(match.group(1))
|
||||||
with open('lib/solaar/commit', 'w') as vfile:
|
with open('lib/solaar/commit', 'w') as vfile:
|
||||||
vfile.write(f'{version}-g{commit_match[1]}\n')
|
vfile.write(f'{match.group[1]}\n')
|
||||||
print(subprocess.check_output(['pwd'], stderr=subprocess.DEVNULL).strip().decode())
|
print(
|
||||||
try:
|
'DPKG VERSION',
|
||||||
print(subprocess.check_output(['dpkg-parsechangelog'], stderr=subprocess.DEVNULL).strip().decode())
|
subprocess.check_output(['dpkg-parsechangelog', '--show-field', 'Version'],
|
||||||
except Exception:
|
stderr=subprocess.DEVNULL).strip().decode()
|
||||||
pass
|
)
|
||||||
print(os.environ)
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def _data_files():
|
def _data_files():
|
||||||
|
|
Loading…
Reference in New Issue