OmniSciDB  4201147b46
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
version.py
Go to the documentation of this file.
1 import os
2 import importlib_metadata
3 
4 
6  d = dict(MAJOR='6', MINOR='0', MICRO='0', EXTRA='none')
7  here = os.path.abspath(os.path.dirname(__file__))
8  try:
9  f = open(os.path.join(here, '..', '..', 'CMakeLists.txt'))
10  except FileNotFoundError:
11  return None
12  for line in f.readlines():
13  if line.lstrip().startswith('set(MAPD_VERSION_'):
14  k = line.split()[0].rsplit('_', 1)[-1]
15  n = line.split('"')[1]
16  d[k] = n
17  return '{MAJOR}.{MINOR}.{MICRO}{EXTRA}'.format(**d)
18 
19 
21  try:
22  return importlib_metadata.version(__name__)
23  except importlib_metadata.PackageNotFoundError:
24  # package is not installed
25  return get_source_version()
int open(const char *path, int flags, int mode)
Definition: heavyai_fs.cpp:64
def get_source_version
Definition: version.py:5
def get_package_version
Definition: version.py:20