Skip to content

Commit

Permalink
setup.py: get version from tag
Browse files Browse the repository at this point in the history
  • Loading branch information
julianoes committed Dec 9, 2019
1 parent 47bab28 commit 36ea732
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import os
import stat
import sys
import subprocess


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


def version():
process = subprocess.Popen(["git", "describe", "--tags"],
stdout=subprocess.PIPE)
(output, err) = process.communicate()
exit_code = process.wait()
if exit_code != 0:
raise RuntimeError(f"git describe command exited with: {exit_code}")
return output.decode("utf-8").strip()


setup(
name="mavsdk",
version="0.5.0",
version=version(),
description="Python wrapper for MAVSDK",
long_description=parse_long_description(),
url="https://github.com/mavlink/MAVSDK-Python",
Expand Down

0 comments on commit 36ea732

Please sign in to comment.