From 708d7365a93fdc60106ac6d0f26449f153b7f39c Mon Sep 17 00:00:00 2001 From: Dmitry Kann Date: Sun, 18 Aug 2024 11:06:46 +0200 Subject: [PATCH] =?UTF-8?q?replace=20deprecated=20pkg=5Fresources=20?= =?UTF-8?q?=E2=87=92=20importlib?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/indicator_sound_switcher/__init__.py | 6 +++--- lib/indicator_sound_switcher/indicator.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/indicator_sound_switcher/__init__.py b/lib/indicator_sound_switcher/__init__.py index dc0b595..ca95ed3 100644 --- a/lib/indicator_sound_switcher/__init__.py +++ b/lib/indicator_sound_switcher/__init__.py @@ -29,7 +29,7 @@ import fcntl import gettext -from .indicator import SoundSwitcherIndicator, APP_ID +from .indicator import SoundSwitcherIndicator, APP_ID, APP_NAME, APP_VERSION def _parse_cmd_line(): @@ -62,8 +62,8 @@ def main(): fcntl.lockf(fd, fcntl.LOCK_EX | fcntl.LOCK_NB) # Instantiate and run the indicator - logging.info('Starting indicator application') + logging.info('%s v%s', APP_NAME, APP_VERSION) SoundSwitcherIndicator().run() except OSError: - logging.info('Indicator is already running, exiting') + logging.info('%s is already running, exiting', APP_NAME) diff --git a/lib/indicator_sound_switcher/indicator.py b/lib/indicator_sound_switcher/indicator.py index 91736d3..6b66720 100644 --- a/lib/indicator_sound_switcher/indicator.py +++ b/lib/indicator_sound_switcher/indicator.py @@ -1,7 +1,7 @@ import os.path import logging import time -import pkg_resources +from importlib.metadata import version import gi @@ -38,7 +38,7 @@ with this program. If not, see http://www.gnu.org/licenses/""" # Determine app version -APP_VERSION = pkg_resources.require(APP_ID)[0].version +APP_VERSION = version(APP_ID) YESNO = {False: 'No', True: 'Yes'}