Skip to content

Commit

Permalink
Update python build-script to get version (mamolinux#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
hsbasu authored Feb 15, 2024
1 parent 9ed6f11 commit d742e83
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,13 @@
from distutils.log import info
import distutils.command.install_data

for line in subprocess.check_output('dpkg-parsechangelog --format rfc822'.split(),
universal_newlines=True).splitlines():
header, colon, value = line.lower().partition(':')
if header == 'version':
version = value.strip()
break
else:
raise RuntimeError('No version found in debian/changelog')

with open("src/SimplePwgen/VERSION", "w") as f:
try:
version = (subprocess.check_output(["dpkg-parsechangelog",
"--show-field", "Version"])).decode().strip("\n")
except:
raise RuntimeError('No version found in debian/changelog')

if '~' in version:
version = version.split('~')[0]
f.write("%s" % version)
Expand Down Expand Up @@ -50,7 +47,7 @@ def create_mo_files():
os.makedirs("data/locale/%s" % lang, exist_ok=True)
mo = "data/locale/%s/%s.mo" % (lang, prefix)
subprocess.run(['msgfmt', '-o', str(mo), po_file], check=True)

mo_file = map(lambda i: ('share/locale/%s/LC_MESSAGES' % lang, [i+'/%s.mo' % prefix]), glob.glob('data/locale/%s' % lang))
data_files.extend(mo_file)

Expand Down

0 comments on commit d742e83

Please sign in to comment.