changeset 162:ddfadedf2aed

core: added __version__ variable
author Goffi <goffi@goffi.org>
date Sat, 28 Apr 2018 11:05:03 +0200
parents 98a485512289
children ef09dce878c7
files cagou/__init__.py
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/cagou/__init__.py	Sat Apr 28 11:04:17 2018 +0200
+++ b/cagou/__init__.py	Sat Apr 28 11:05:03 2018 +0200
@@ -17,6 +17,12 @@
 # You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+import os.path
+
+
+version_file = os.path.join(os.path.dirname(__file__), 'VERSION')
+with open(version_file) as f:
+    __version__ = f.read().strip()
 
 class Global(object):
     @property
@@ -24,10 +30,9 @@
         return self._host
 G = Global()
 
-
+# this import must be done after G is created
 from core import cagou_main
 
-
 def run():
     host = G._host = cagou_main.Cagou()
     host.run()