|
1 | 1 | from datetime import datetime
|
2 | 2 | from setuptools import setup
|
3 | 3 | from pathlib import Path
|
| 4 | +import subprocess |
| 5 | +import re |
4 | 6 |
|
5 | 7 | stub_root = Path("circuitpython-stubs")
|
6 | 8 | stubs = [p.relative_to(stub_root).as_posix() for p in stub_root.glob("*.pyi")]
|
7 | 9 |
|
| 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 | + |
8 | 24 | setup(
|
9 | 25 | name="circuitpython-stubs",
|
10 | 26 | description="PEP 561 type stubs for CircuitPython",
|
11 | 27 | url="https://github.com/adafruit/circuitpython",
|
12 | 28 | maintainer="CircuitPythonistas",
|
| 29 | + maintainer_email="[email protected]", |
13 | 30 |
|
14 |
| - use_scm_version=True, |
| 31 | + version=version, |
15 | 32 | license="MIT",
|
16 | 33 | package_data={"circuitpython-stubs": stubs},
|
17 | 34 | packages=["circuitpython-stubs"],
|
18 |
| - setup_requires=["setuptools>=38.6.0", |
19 |
| - "setuptools_scm"], |
| 35 | + setup_requires=["setuptools>=38.6.0"], |
20 | 36 | )
|
0 commit comments