diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2023-03-02 22:56:06 +0100 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2023-03-02 23:06:26 +0100 |
commit | bc3c7c7190c5acaeb03ef82dc41cc716aaff76c6 (patch) | |
tree | e732851b92346135bcff5686181db6074df9724b /project/version.py | |
parent | workflows/basic: test more Python versions (diff) | |
download | cmake-common-bc3c7c7190c5acaeb03ef82dc41cc716aaff76c6.tar.gz cmake-common-bc3c7c7190c5acaeb03ef82dc41cc716aaff76c6.zip |
add runtime version information
Diffstat (limited to '')
-rw-r--r-- | project/version.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/project/version.py b/project/version.py new file mode 100644 index 0000000..8cff333 --- /dev/null +++ b/project/version.py @@ -0,0 +1,15 @@ +try: + import importlib.metadata as metadata +except ImportError: + import importlib_metadata as metadata + + +try: + __version__ = metadata.version('cmake_common') +except Exception: + __version__ = 'unknown' + + +def add_to_arg_parser(parser): + parser.add_argument('--version', '-V', action='version', + version=f'%(prog)s {__version__}') |