Skip to content

Commit

Permalink
fixed version-handling
Browse files Browse the repository at this point in the history
  • Loading branch information
ansibleguy committed Jan 17, 2024
1 parent d8d5596 commit 7ef2119
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/ansible-webui/aw/config/main.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
from os import environ
from importlib.metadata import version
from importlib.metadata import version, PackageNotFoundError
from sys import stderr

from pytz import all_timezones

from aw.config.environment import ENVIRON_FALLBACK


VERSION = environ['AW_VERSION'] if 'AW_VERSION' in environ else version('ansible-webui')
def get_version() -> str:
if 'AW_VERSION' in environ:
return environ['AW_VERSION']

try:
return version('ansible-webui')

except PackageNotFoundError:
stderr.write('\x1b[1;33mWARNING: Module version could not be determined!\x1b[0m\n')
return '0.0.0'


VERSION = get_version()


def init_globals():
Expand Down

0 comments on commit 7ef2119

Please sign in to comment.