You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-01 06:46:55 +03:00
MCOL-5496: Merge CMAPI code to engine repo.
[add] cmapi code to engine
This commit is contained in:
committed by
Alan Mologorsky
parent
77eedd1756
commit
a079a2c944
29
cmapi/cmapi_server/managers/application.py
Normal file
29
cmapi/cmapi_server/managers/application.py
Normal file
@ -0,0 +1,29 @@
|
||||
import logging
|
||||
from typing import Optional
|
||||
|
||||
from cmapi_server.constants import VERSION_PATH
|
||||
|
||||
|
||||
class AppManager:
|
||||
started: bool = False
|
||||
version: Optional[str] = None
|
||||
|
||||
@classmethod
|
||||
def get_version(cls) -> str:
|
||||
"""Get CMAPI version.
|
||||
|
||||
:return: cmapi version
|
||||
:rtype: str
|
||||
"""
|
||||
if cls.version:
|
||||
return cls.version
|
||||
with open(VERSION_PATH, encoding='utf-8') as version_file:
|
||||
version = '.'.join([
|
||||
i.strip().split('=')[1]
|
||||
for i in version_file.read().splitlines() if i
|
||||
])
|
||||
if not version:
|
||||
logging.error('Couldn\'t detect version from VERSION file!')
|
||||
version = 'Undefined'
|
||||
cls.version = version
|
||||
return cls.version
|
Reference in New Issue
Block a user