From cdd762a07a5a101fe31152580453e79f293bc53d Mon Sep 17 00:00:00 2001 From: krateng Date: Sat, 25 Dec 2021 22:02:28 +0100 Subject: [PATCH] Adjusted pkginfo --- maloja/__pkginfo__.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/maloja/__pkginfo__.py b/maloja/__pkginfo__.py index 61d2014..df9a902 100644 --- a/maloja/__pkginfo__.py +++ b/maloja/__pkginfo__.py @@ -1,11 +1,19 @@ # This file has now been slighly repurposed and will simply give other parts of # the package access to some global meta-information about itself -import pkg_resources -self = pkg_resources.get_distribution('maloja') +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'] -versionstr = self.version -version = self.version.split('.') +versionstr = metadata['version'] +version = versionstr.split('.') urls = { "repo":"https://github.com/krateng/maloja" }