[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Health-dev] Improve SYSINFO command
From: |
Gerald Wiese |
Subject: |
[Health-dev] Improve SYSINFO command |
Date: |
Fri, 22 Mar 2024 19:43:41 +0100 |
User-agent: |
Mozilla Thunderbird |
Hi,
I was investigating how to properly set the desired environment
variables GNUHEALTH_VERSION & TRYTON_VERSION for the SYSINFO command.
My problem was that I wanted to read them dynamically from pip version
but I could not manage to make uWSGI or systemd to do so on environment
variables.
And I would prefer to avoid passing .gnuhealthrc or a shell script to
the service.
However I ended up finding a way to eliminate them. The following change
on health.py enables to read those versions using the importlib library
instead:
22d21
< import importlib.metadata
5675c5674
< f"{importlib.metadata.version('gnuhealth')}\n"
---
> f"{os.environ['GNUHEALTH_VERSION']}\n"
5677c5676
< tryton_version = f"Tryton server:
{importlib.metadata.version('trytond')}\n"
---
> tryton_version = f"Tryton server:
{os.environ['TRYTON_VERSION']}\n"
Was introduced in Python 3.8 which is the oldest Python version that did
not reach end of life:
https://docs.python.org/3/library/importlib.metadata.html
Not sure what that would mean for openSUSE.
What do you think?
Best
Gerald
- [Health-dev] Improve SYSINFO command,
Gerald Wiese <=