From df6e4d7c37edda3f687bb31db1b3e12a67eab831 Mon Sep 17 00:00:00 2001
From: Andrew Tridgell <andrew@tridgell.net>
Date: Sat, 19 Feb 2022 10:00:19 +1100
Subject: [PATCH] allow for print(pymavlink.__version__)

---
 __init__.py | 1 +
 setup.py    | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/__init__.py b/__init__.py
index 07a5c05c..dce829a4 100644
--- a/__init__.py
+++ b/__init__.py
@@ -1 +1,2 @@
 '''Python MAVLink library - see https://mavlink.io/en/'''
+__version__ = '2.4.25'
diff --git a/setup.py b/setup.py
index 7b1325f4..df5e3b32 100644
--- a/setup.py
+++ b/setup.py
@@ -13,8 +13,8 @@ except LookupError:
 from setuptools import setup, Extension
 import glob, os, shutil, fnmatch, platform, sys
 
-version = '2.4.25'
-
+sys.path.insert(0, os.path.dirname(__file__))
+from __init__ import __version__
 
 def generate_content():
     # generate the file content...
@@ -107,7 +107,7 @@ class custom_build_py(build_py):
 
 
 setup (name = 'pymavlink',
-       version = version,
+       version = __version__,
        description = 'Python MAVLink code',
        long_description = ('A Python library for handling MAVLink protocol streams and log files. This allows for the '
                            'creation of simple scripts to analyse telemetry logs from autopilots such as ArduPilot which use '
-- 
GitLab