]> Repositories - Adafruit_Blinka-hackapet.git/blob - setup.py
Merge pull request #723 from mmontol/main
[Adafruit_Blinka-hackapet.git] / setup.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3
4 # SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries
5 #
6 # SPDX-License-Identifier: MIT
7
8 # Note: To use the 'upload' functionality of this file, you must:
9 #   $ pip install twine
10
11 import io
12 import os
13 import sys
14
15 from setuptools import setup, find_packages
16
17 here = os.path.abspath(os.path.dirname(__file__))
18
19 # Import the README and use it as the long-description.
20 # Note: this will only work if 'README.md' is present in your MANIFEST.in file!
21 with io.open(os.path.join(here, "README.rst"), encoding="utf-8") as f:
22     long_description = "\n" + f.read()
23
24 board_reqs = []
25 if os.path.exists("/proc/device-tree/compatible"):
26     with open("/proc/device-tree/compatible", "rb") as f:
27         compat = f.read()
28     if b"nvidia,tegra" in compat:
29         board_reqs = ["Jetson.GPIO"]
30     if (
31         b"brcm,bcm2835" in compat
32         or b"brcm,bcm2836" in compat
33         or b"brcm,bcm2837" in compat
34         or b"brcm,bcm2838" in compat
35         or b"brcm,bcm2711" in compat
36     ):
37         board_reqs = ["RPi.GPIO", "rpi_ws281x>=4.0.0", "sysv_ipc>=1.1.0"]
38     if (
39         b"ti,am335x" in compat
40     ):  # BeagleBone Black, Green, PocketBeagle, BeagleBone AI, etc.
41         board_reqs = ["Adafruit_BBIO"]
42
43 setup(
44     name="Adafruit-Blinka",
45     use_scm_version={
46         # This is needed for the PyPI version munging in the Github Actions release.yml
47         "git_describe_command": "git describe --tags --long",
48         "local_scheme": "no-local-version",
49     },
50     setup_requires=["setuptools_scm"],
51     description="CircuitPython APIs for non-CircuitPython versions of Python such as CPython on Linux and MicroPython.",
52     long_description=long_description,
53     long_description_content_type="text/x-rst",
54     author="Adafruit Industries",
55     author_email="circuitpython@adafruit.com",
56     python_requires=">=3.7.0",
57     url="https://github.com/adafruit/Adafruit_Blinka",
58     package_dir={"": "src"},
59     packages=find_packages("src") + ["micropython-stubs"],
60     # py_modules lists top-level single file packages to include.
61     # find_packages only finds packages in directories with __init__.py files.
62     py_modules=[
63         "analogio",
64         "bitbangio",
65         "board",
66         "busio",
67         "digitalio",
68         "keypad",
69         "micropython",
70         "neopixel_write",
71         "onewireio",
72         "pulseio",
73         "pwmio",
74         "rainbowio",
75         "usb_hid",
76     ],
77     package_data={
78         "adafruit_blinka.microcontroller.bcm283x.pulseio": [
79             "libgpiod_pulsein",
80             "libgpiod_pulsein64",
81         ],
82         "adafruit_blinka.microcontroller.amlogic.meson_g12_common.pulseio": [
83             "libgpiod_pulsein",
84         ],
85         "micropython-stubs": ["*.pyi"],
86     },
87     include_package_data=True,
88     install_requires=[
89         "Adafruit-PlatformDetect>=3.52.0",
90         "Adafruit-PureIO>=1.1.7",
91         "pyftdi>=0.40.0",
92         "adafruit-circuitpython-typing",
93     ]
94     + board_reqs,
95     license="MIT",
96     classifiers=[
97         # Trove classifiers
98         # Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
99         "License :: OSI Approved :: MIT License",
100         "Programming Language :: Python",
101         "Programming Language :: Python :: 3",
102         "Programming Language :: Python :: 3.7",
103         "Programming Language :: Python :: Implementation :: MicroPython",
104     ],
105 )