From 82a5d80895f2bdf9e910c6a4a4359227d0c5e3c0 Mon Sep 17 00:00:00 2001 From: Himadri Sekhar Basu <41947504+hsbasu@users.noreply.github.com> Date: Sun, 3 Mar 2024 09:06:53 +0530 Subject: [PATCH] Update python packaging scripts (#49) - Update setuptools version - Add python dependencies - Update dynamic versioning in setup.py --- pyproject.toml | 2 +- setup.cfg | 7 ++++++- setup.py | 22 +++++++++------------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b0f0765..638dd9c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,3 @@ [build-system] -requires = ["setuptools>=42"] +requires = ["setuptools>=61.0"] build-backend = "setuptools.build_meta" diff --git a/setup.cfg b/setup.cfg index 1a23093..0641559 100644 --- a/setup.cfg +++ b/setup.cfg @@ -23,9 +23,14 @@ classifiers = [options] package_dir = = src -packages = find: +packages = find_namespace: python_requires = >=3.6 include_package_data = True +install_requires = + configobj + PyGObject + setproctitle + tldextract [options.package_data] * = *VERSION diff --git a/setup.py b/setup.py index 470449e..b15bca5 100644 --- a/setup.py +++ b/setup.py @@ -3,21 +3,17 @@ import subprocess from setuptools import setup -from subprocess import check_output - -for line in 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/BatteryMonitor/VERSION", "w") as f: - if '~' in version: - version = version.split('~')[0] - f.write("%s" % version) + 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) gschema_dir_suffix = 'share/glib-2.0/schemas'