diff --git a/build/Makefile b/build/Makefile index 2886d82..4227220 100644 --- a/build/Makefile +++ b/build/Makefile @@ -1,5 +1,7 @@ VERSION_AND_REVISION = $(shell git describe --tags --dirty | sed -e 's/^v//') PKG_ID = traymenu_${VERSION_AND_REVISION}_all +PYMOD_VERSION = $(shell PYTHONPATH=../src:$$PYTHONPATH python3 -c \ + 'import traymenu; print(traymenu.__version__)') BUILD_DIR = ./build_dir BASE_DIR = ${BUILD_DIR}/${PKG_ID} @@ -29,6 +31,11 @@ copy_files: cp ../doc/traymenu.svg ${ICON_DIR} chmod -R g-w ${BASE_DIR} +.PHONY: show_version +show_version: + @echo "Traymenu version according to git: '${VERSION_AND_REVISION}'" + @echo "Traymenu version according to Python: '${PYMOD_VERSION}'" + .PHONY: clean clean: rm -rf ${BUILD_DIR} diff --git a/src/bin/traymenu b/src/bin/traymenu index e503b3f..b78568c 100755 --- a/src/bin/traymenu +++ b/src/bin/traymenu @@ -4,6 +4,7 @@ A Gtk- or Qt-based menu for the system tray to execute arbitrary commands. """ +import os.path import signal import sys import tempfile @@ -35,7 +36,9 @@ def get_config() -> traymenu.Config: return config except ValueError as e: - usage_str = traymenu.USAGE_STR.replace("traymenu", sys.argv[0], 1) + usage_str = (traymenu.USAGE_STR. + replace("traymenu", os.path.basename(sys.argv[0]), 1). + replace("", traymenu.__version__)) print(f"Error: {e}") print() print(usage_str, end="") diff --git a/src/traymenu/__init__.py b/src/traymenu/__init__.py index 64d0276..22949dc 100644 --- a/src/traymenu/__init__.py +++ b/src/traymenu/__init__.py @@ -1,3 +1,5 @@ +__version__ = "0.1" + from traymenu.config import Config, USAGE_STR, \ MenuItem, Separator, SubmenuStart, SubmenuEnd, MenuEntry from traymenu.exec import run_command, run_command_wrapper, debug_output diff --git a/src/traymenu/config.py b/src/traymenu/config.py index 7ed99e1..58c0bed 100644 --- a/src/traymenu/config.py +++ b/src/traymenu/config.py @@ -17,6 +17,7 @@ --submenu