From ee27a5b0e0abcb08ce54fd41a5098522a812f8bd Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Tue, 2 Jan 2024 13:22:23 +0000 Subject: Consistently use GN_VERSION from app config. GN_VERSION is set in the configuration file and read into the app config dictionary. Use that instead of re-reading from the etc/VERSION file. * gn2/utility/tools.py (gn_version): Delete function. (GN_VERSION): Delete variable. * gn2/wqflask/metadata_edits.py (display_phenotype_metadata, display_probeset_metadata, show_history): Use GN_VERSION in app config. * gn2/wqflask/views.py: Do not import GN_VERSION from gn2.utility.tools. (handle_generic_exceptions, index_page.__render__, submit_trait_form): Use GN_VERSION in app config. --- gn2/utility/tools.py | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'gn2/utility') diff --git a/gn2/utility/tools.py b/gn2/utility/tools.py index 7adf8e8f..159643d3 100644 --- a/gn2/utility/tools.py +++ b/gn2/utility/tools.py @@ -264,18 +264,7 @@ def gn_version_repo_info(root_dir): except: return "" -def gn_version(): - """Compute and return the version of the application.""" - hostname = socket.gethostname() - basedir = Path(__file__).absolute().parent.parent.parent - with open(Path(basedir, "etc", "VERSION"), encoding="utf8") as version_file: - version_contents = version_file.read().strip() - base_version = f"{hostname}:{basedir.name}:{version_contents}" - repo_info = gn_version_repo_info(basedir) - return f"{base_version}-{repo_info}" if bool(repo_info) else base_version - # Cached values -GN_VERSION = gn_version() HOME = get_setting('HOME') SERVER_PORT = get_setting('SERVER_PORT') WEBSERVER_MODE = get_setting('WEBSERVER_MODE') -- cgit v1.2.3