From 606f66d1b4390be25e7b2966b97ad88fbd3db832 Mon Sep 17 00:00:00 2001 From: Dmitry Kann Date: Sun, 27 Dec 2020 20:26:29 +0100 Subject: [PATCH] Determine app version based on the installed package --- build_package | 5 ++--- debian/changelog | 6 ++++++ lib/indicator_sound_switcher/indicator.py | 5 ++++- setup.py | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/build_package b/build_package index 8324ed2..5787ec3 100755 --- a/build_package +++ b/build_package @@ -37,9 +37,8 @@ APP_VERSION=$(sed -ne 's/\s*APP_VERSION\s*=\s*\x27\([^\x27]\+\)\x27.*/\1/p' "$SE echo "Building ${APP_NAME} version ${APP_VERSION} revision ${REVISION}..." # Verify the changelog contains the appropriate line -app_ver_string="${APP_NAME} (${APP_VERSION}-${REVISION})" -(head -n 1 "debian/changelog" | grep -q "$app_ver_string") || - err "The changelog doesn't start with the entry '${app_ver_string}'" +[[ "$(dpkg-parsechangelog -S version)" == "$APP_VERSION-$REVISION" ]] || + err "The changelog doesn't start with the entry for version $APP_VERSION-$REVISION" # Initial cleanup: clean the dist dirs [[ ! -d "$DIST_ROOT_DIR" ]] || rm -rf "$DIST_ROOT_DIR" || err "Removing $DIST_ROOT_DIR failed" diff --git a/debian/changelog b/debian/changelog index 374590a..505e538 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +indicator-sound-switcher (2.3.5.2-1) focal; urgency=low + + * Determine app version based on the installed package + + -- Dmitry Kann Sun, 27 Dec 2020 20:25:24 +0200 + indicator-sound-switcher (2.3.5.1-1) focal; urgency=low * No-change commit to address Launchpad failure diff --git a/lib/indicator_sound_switcher/indicator.py b/lib/indicator_sound_switcher/indicator.py index bb99c35..b8b5474 100644 --- a/lib/indicator_sound_switcher/indicator.py +++ b/lib/indicator_sound_switcher/indicator.py @@ -1,6 +1,7 @@ import os.path import logging import time +import pkg_resources import gi @@ -24,7 +25,6 @@ # Global definitions APP_ID = 'indicator-sound-switcher' APP_NAME = 'Sound Switcher Indicator' -APP_VERSION = '2.3.5' APP_LICENCE = """This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3, as published by the Free Software Foundation. @@ -37,6 +37,9 @@ You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/""" +# Determine app version +APP_VERSION = pkg_resources.require(APP_ID)[0].version + YESNO = {False: 'No', True: 'Yes'} CARD_NONE_SINK = -1 diff --git a/setup.py b/setup.py index 4c6f05d..522f6e6 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ APP_ID = 'indicator-sound-switcher' -APP_VERSION = '2.3.5' +APP_VERSION = '2.3.5.2' def compile_lang_files() -> list: