maloja/maloja/__pkginfo__.py

21 lines
579 B
Python
Raw Normal View History

2021-12-24 08:30:19 +03:00
# This file has now been slighly repurposed and will simply give other parts of
# the package access to some global meta-information about itself
2021-12-26 00:02:28 +03:00
try:
# package distributrion
import pkg_resources
self = pkg_resources.get_distribution('maloja')
metadata = {'version':self.version}
except:
# from source
import toml
with open("./pyproject.toml") as filed:
metadata = toml.load(filed)['project']
2020-03-06 19:06:08 +03:00
2021-12-26 00:02:28 +03:00
versionstr = metadata['version']
version = versionstr.split('.')
2021-12-24 08:30:19 +03:00
urls = {
"repo":"https://github.com/krateng/maloja"
2020-03-06 19:06:08 +03:00
}
2021-12-24 08:30:19 +03:00
user_agent = f"Maloja/{versionstr} ( {urls['repo']} )"