Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions mavsdk/__init__.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
# -*- coding: utf-8 -*-

import asyncio
import platform
import sys
import importlib.metadata
import warnings

from .system import System, MavsdkServerExitedError

# Check for compatibility
(major, minor, _) = platform.python_version_tuple()
if not ((int(major) >= 3 and int(minor) >= 6) or (int(major) >= 4)):
print("[!] MAVSDK-Python is only available on Python >= 3.6")
sys.exit(1)

# Written by setup.py at build time. Absent when running from a source checkout,
# in which case there is nothing to warn about.
# in which case there is nothing to warn about and no version to report.
try:
from ._dist import DIST_NAME as _dist_name
except ImportError:
_dist_name = None

# Version of the installed distribution, as shown by `pip show`, e.g. "4.3.0".
# The bundled mavsdk_server has the same version; it logs it on startup
# ("MAVSDK version: v4.3.0").
try:
__version__ = importlib.metadata.version(_dist_name) if _dist_name else "unknown"
except importlib.metadata.PackageNotFoundError:
__version__ = "unknown"

if _dist_name == "mavsdk":
# A FutureWarning rather than a DeprecationWarning: the latter is filtered
# out by default unless it is raised from __main__, which would hide this
Expand Down
Loading