circuitpython/setup.py-stubs

50 lines
1.5 KiB
Plaintext
Raw Normal View History

2020-06-03 18:40:05 -04:00
# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors)
#
# SPDX-License-Identifier: MIT
2021-06-01 21:38:56 -04:00
import os
import site
from datetime import datetime
from typing import Dict, List
2021-06-01 21:38:56 -04:00
from setuptools import setup
from pathlib import Path
def local_scheme(version):
return ""
2020-05-13 17:45:09 -04:00
STD_PACKAGES = set(('array', 'math', 'os', 'random', 'struct', 'sys', 'ssl', 'time'))
stub_root = Path(".")
stubs = [p.relative_to(stub_root) for p in stub_root.glob("*/*.pyi")]
packages = set(stub.parent.as_posix() for stub in stubs) - STD_PACKAGES
package_dir = dict((f"{package}-stubs", package)
for package in packages)
2020-05-13 17:45:09 -04:00
def build_package_data() -> Dict[str, List[str]]:
result = {}
for package in packages:
result[f"{package}-stubs"] = ["*.pyi", "*/*.pyi"]
2021-06-01 21:38:56 -04:00
return result
package_data=build_package_data()
setup(
name="circuitpython-stubs",
description="PEP 561 type stubs for CircuitPython",
url="https://github.com/adafruit/circuitpython",
maintainer="CircuitPythonistas",
2020-05-13 17:45:09 -04:00
maintainer_email="circuitpython@adafruit.com",
author_email="circuitpython@adafruit.com",
license="MIT",
packages=list(package_data.keys()),
package_data=package_data,
package_dir = package_dir,
setup_requires=["setuptools_scm", "setuptools>=38.6.0"],
use_scm_version = {
"root": "..",
"relative_to": __file__,
"local_scheme": local_scheme,
"git_describe_command": "tools/describe",
},
zip_safe=False,
)