[pkginfo] Retrieve Cubicweb version using pkg_resources
authorNsukami Patrick <ptrck at nskm dot xyz>
Tue, 03 Dec 2019 11:34:56 +0100
changeset 12784 894d0fd94f73
parent 12783 842939e69f3a
child 12785 a9025212ce0c
[pkginfo] Retrieve Cubicweb version using pkg_resources
cubicweb/cwconfig.py
--- a/cubicweb/cwconfig.py	Fri Nov 22 12:06:52 2019 +0000
+++ b/cubicweb/cwconfig.py	Tue Dec 03 11:34:56 2019 +0100
@@ -409,11 +409,12 @@
     def cubicweb_version():
         """return installed cubicweb version"""
         from logilab.common.changelog import Version
-        from cubicweb import __pkginfo__
-        version = __pkginfo__.numversion
+        str_base_version = pkg_resources.get_distribution('cubicweb').parsed_version.base_version
+        version = tuple([int(x) for x in str_base_version.split('.')])
         assert len(version) == 3, version
         return Version(version)
 
+
     @staticmethod
     def persistent_options_configuration():
         return Configuration(options=PERSISTENT_OPTIONS)