Correct version numbering
This commit is contained in:
parent
3ffa5604fc
commit
794d5f5900
1 changed files with 19 additions and 3 deletions
22
setup.py
22
setup.py
|
|
@ -1,20 +1,36 @@
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
import subprocess
|
||||||
|
import re
|
||||||
|
|
||||||
stub_root = Path("circuitpython-stubs")
|
stub_root = Path("circuitpython-stubs")
|
||||||
stubs = [p.relative_to(stub_root).as_posix() for p in stub_root.glob("*.pyi")]
|
stubs = [p.relative_to(stub_root).as_posix() for p in stub_root.glob("*.pyi")]
|
||||||
|
|
||||||
|
git_out = subprocess.check_output(["git", "describe", "--tags"])
|
||||||
|
version = git_out.strip().decode("utf-8")
|
||||||
|
|
||||||
|
# Detect a development build and mutate it to be valid semver and valid python version.
|
||||||
|
pieces = version.split("-")
|
||||||
|
if len(pieces) > 2:
|
||||||
|
# Merge the commit portion onto the commit count since the tag.
|
||||||
|
pieces[-2] += "+" + pieces[-1]
|
||||||
|
pieces.pop()
|
||||||
|
# Merge the commit count and build to the pre-release identifier.
|
||||||
|
pieces[-2] += ".dev." + pieces[-1]
|
||||||
|
pieces.pop()
|
||||||
|
version = "-".join(pieces)
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="circuitpython-stubs",
|
name="circuitpython-stubs",
|
||||||
description="PEP 561 type stubs for CircuitPython",
|
description="PEP 561 type stubs for CircuitPython",
|
||||||
url="https://github.com/adafruit/circuitpython",
|
url="https://github.com/adafruit/circuitpython",
|
||||||
maintainer="CircuitPythonistas",
|
maintainer="CircuitPythonistas",
|
||||||
|
maintainer_email="circuitpython@adafruit.com",
|
||||||
author_email="circuitpython@adafruit.com",
|
author_email="circuitpython@adafruit.com",
|
||||||
use_scm_version=True,
|
version=version,
|
||||||
license="MIT",
|
license="MIT",
|
||||||
package_data={"circuitpython-stubs": stubs},
|
package_data={"circuitpython-stubs": stubs},
|
||||||
packages=["circuitpython-stubs"],
|
packages=["circuitpython-stubs"],
|
||||||
setup_requires=["setuptools>=38.6.0",
|
setup_requires=["setuptools>=38.6.0"],
|
||||||
"setuptools_scm"],
|
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue