Skip to content

Commit

Permalink
Update setup.py
Browse files Browse the repository at this point in the history
automatically pull version from tag
  • Loading branch information
Stanford-CVX-group authored Aug 23, 2023
1 parent 92d3460 commit da7ec70
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
from setuptools import find_packages, setup
import subprocess

with open("README.md", "r") as fh:
long_description = fh.read()

# get all the git tags from the cmd line that follow our versioning pattern
git_tags = subprocess.Popen(
["git", "tag", "--list", "v*[0-9]", "--sort=version:refname"],
stdout=subprocess.PIPE,
)
tags = git_tags.stdout.read()
git_tags.stdout.close()
tags = tags.decode("utf-8").split("\n")
tags.sort()

# PEP 440 won't accept the v in front, so here we remove it, strip the new line and decode the byte stream
VERSION_FROM_GIT_TAG = tags[-1][1:]

setup(
name="sig-decomp",
version="0.1.1",
version=VERSION_FROM_GIT_TAG,
description="Optimzation-based signal decomposition",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit da7ec70

Please sign in to comment.