# HG changeset patch # User RhodeCode Admin # Date 2023-12-27 12:34:37 # Node ID 2c7f5b16bf29301c1bad2113b24239f77d53c8a3 # Parent dc28b3979afa4f18dd79b19f590a33319f542ef9 feat(version): cache version to read from it not from file diff --git a/vcsserver/__init__.py b/vcsserver/__init__.py --- a/vcsserver/__init__.py +++ b/vcsserver/__init__.py @@ -17,13 +17,20 @@ import os +__version__ = '' + def get_version(): + global __version__ + if __version__: + return __version__ + here = os.path.abspath(os.path.dirname(__file__)) ver_file = os.path.join(here, "VERSION") with open(ver_file, "rt") as f: version = f.read().strip() + __version__ = version return version # link to config for pyramid