summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorBenjamin Shockley <benjaminshockley@hotmail.com>2020-08-20 13:48:15 -0500
committerGitHub <noreply@github.com>2020-08-20 13:48:15 -0500
commit0084f0af24e4e219bc040c52ee723959423de6e2 (patch)
tree1aebdb362f08bf6417caa87836e3e4e739afc964 /setup.py
parent9aebe2f1efc99871fcf283c304e3a8700050d736 (diff)
parent4d7b9cde33934a44c4c905a49d2f831339fc8bd2 (diff)
Merge pull request #2 from adafruit/master
Master
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/setup.py b/setup.py
new file mode 100644
index 000000000..769bc66e1
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,36 @@
+from datetime import datetime
+from setuptools import setup
+from pathlib import Path
+import subprocess
+import re
+
+stub_root = Path("circuitpython-stubs")
+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(
+ name="circuitpython-stubs",
+ description="PEP 561 type stubs for CircuitPython",
+ url="https://github.com/adafruit/circuitpython",
+ maintainer="CircuitPythonistas",
+ maintainer_email="circuitpython@adafruit.com",
+ author_email="circuitpython@adafruit.com",
+ version=version,
+ license="MIT",
+ package_data={"circuitpython-stubs": stubs},
+ packages=["circuitpython-stubs"],
+ setup_requires=["setuptools>=38.6.0"],
+)