##// END OF EJS Templates
feat(version): cache version to read from it not from file
super-admin -
r1189:2c7f5b16 default
parent child Browse files
Show More
@@ -1,34 +1,41 b''
1 # RhodeCode VCSServer provides access to different vcs backends via network.
1 # RhodeCode VCSServer provides access to different vcs backends via network.
2 # Copyright (C) 2014-2023 RhodeCode GmbH
2 # Copyright (C) 2014-2023 RhodeCode GmbH
3 #
3 #
4 # This program is free software; you can redistribute it and/or modify
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
7 # (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software Foundation,
15 # along with this program; if not, write to the Free Software Foundation,
16 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
18 import os
18 import os
19
19
20 __version__ = ''
21
20
22
21 def get_version():
23 def get_version():
24 global __version__
25 if __version__:
26 return __version__
27
22 here = os.path.abspath(os.path.dirname(__file__))
28 here = os.path.abspath(os.path.dirname(__file__))
23 ver_file = os.path.join(here, "VERSION")
29 ver_file = os.path.join(here, "VERSION")
24 with open(ver_file, "rt") as f:
30 with open(ver_file, "rt") as f:
25 version = f.read().strip()
31 version = f.read().strip()
26
32
33 __version__ = version
27 return version
34 return version
28
35
29 # link to config for pyramid
36 # link to config for pyramid
30 CONFIG = {}
37 CONFIG = {}
31
38
32 # Populated with the settings dictionary from application init in
39 # Populated with the settings dictionary from application init in
33 #
40 #
34 PYRAMID_SETTINGS = {}
41 PYRAMID_SETTINGS = {}
General Comments 0
You need to be logged in to leave comments. Login now