Skip to content

Commit 36ea732

Browse files
committed
setup.py: get version from tag
1 parent 47bab28 commit 36ea732

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

setup.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import os
99
import stat
1010
import sys
11+
import subprocess
1112

1213

1314
def parse_requirements(filename):
@@ -100,9 +101,19 @@ def download_mavsdk_server(self):
100101
os.chmod(self.mavsdk_server_filepath, st.st_mode | stat.S_IEXEC)
101102

102103

104+
def version():
105+
process = subprocess.Popen(["git", "describe", "--tags"],
106+
stdout=subprocess.PIPE)
107+
(output, err) = process.communicate()
108+
exit_code = process.wait()
109+
if exit_code != 0:
110+
raise RuntimeError(f"git describe command exited with: {exit_code}")
111+
return output.decode("utf-8").strip()
112+
113+
103114
setup(
104115
name="mavsdk",
105-
version="0.5.0",
116+
version=version(),
106117
description="Python wrapper for MAVSDK",
107118
long_description=parse_long_description(),
108119
url="https://github.com/mavlink/MAVSDK-Python",

0 commit comments

Comments
 (0)