TNO Intern

Commit 31da271d authored by Arjo Segers's avatar Arjo Segers
Browse files

Merge branch 'package-version' into 'master'

Optionally read pacakge version from toml file in case no virtual environment is used.

See merge request !10
parents af3d2346 38f364f6
Loading
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -108,9 +108,20 @@ and are defined according to the following hierchy:
# -------------------------------------------------

# store version number:
try:
    from importlib import metadata

    __version__ = metadata.version(__package__)
except:
    import os
    if "CSO_PREFIX" in os.environ.keys():
        import tomllib
        with open(os.path.join(os.environ["CSO_PREFIX"],"pyproject.toml"),"rb") as f :
            pp = tomllib.load( f )
        __version__ = pp["project"]["version"]
    else:
        __version__ = "x.y"
    #endif
#endtry

# import entities from sub-modules:
from .cso_file import *