Skip to content

Commit 794d5f5

Browse files
committed
Correct version numbering
1 parent 3ffa560 commit 794d5f5

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

setup.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,36 @@
11
from datetime import datetime
22
from setuptools import setup
33
from pathlib import Path
4+
import subprocess
5+
import re
46

57
stub_root = Path("circuitpython-stubs")
68
stubs = [p.relative_to(stub_root).as_posix() for p in stub_root.glob("*.pyi")]
79

10+
git_out = subprocess.check_output(["git", "describe", "--tags"])
11+
version = git_out.strip().decode("utf-8")
12+
13+
# Detect a development build and mutate it to be valid semver and valid python version.
14+
pieces = version.split("-")
15+
if len(pieces) > 2:
16+
# Merge the commit portion onto the commit count since the tag.
17+
pieces[-2] += "+" + pieces[-1]
18+
pieces.pop()
19+
# Merge the commit count and build to the pre-release identifier.
20+
pieces[-2] += ".dev." + pieces[-1]
21+
pieces.pop()
22+
version = "-".join(pieces)
23+
824
setup(
925
name="circuitpython-stubs",
1026
description="PEP 561 type stubs for CircuitPython",
1127
url="https://github.com/adafruit/circuitpython",
1228
maintainer="CircuitPythonistas",
29+
maintainer_email="[email protected]",
1330
author_email="[email protected]",
14-
use_scm_version=True,
31+
version=version,
1532
license="MIT",
1633
package_data={"circuitpython-stubs": stubs},
1734
packages=["circuitpython-stubs"],
18-
setup_requires=["setuptools>=38.6.0",
19-
"setuptools_scm"],
35+
setup_requires=["setuptools>=38.6.0"],
2036
)

0 commit comments

Comments
 (0)