mirror of
https://github.com/meshtastic/python.git
synced 2025-12-24 08:27:55 -05:00
14 lines
447 B
Python
14 lines
447 B
Python
"""Version lookup utilities, isolated for cleanliness"""
|
|
import sys
|
|
try:
|
|
from importlib.metadata import version
|
|
except:
|
|
import pkg_resources
|
|
|
|
def get_active_version():
|
|
"""Get the currently active version using importlib, or pkg_resources if we must"""
|
|
if "importlib.metadata" in sys.modules:
|
|
return version("meshtastic")
|
|
else:
|
|
return pkg_resources.get_distribution("meshtastic").version # pylint: disable=E0601
|