]> Repositories - Adafruit_Blinka-hackapet.git/blob - setup.py
Merge pull request #861 from makermelissa/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
14 from setuptools import setup, find_packages
15
16 here = os.path.abspath(os.path.dirname(__file__))
17
18 # Import the README and use it as the long-description.
19 # Note: this will only work if 'README.md' is present in your MANIFEST.in file!
20 with io.open(os.path.join(here, "README.rst"), encoding="utf-8") as f:
21     long_description = "\n" + f.read()
22
23 board_reqs = []
24 if os.path.exists("/proc/device-tree/compatible"):
25     with open("/proc/device-tree/compatible", "rb") as f:
26         compat = f.read()
27     if b"nvidia,tegra" in compat:
28         board_reqs = ["Jetson.GPIO"]
29     # Pi 4 and Earlier
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     # Pi 5
39     if b"brcm,bcm2712" in compat:
40         board_reqs = ["rpi_ws281x>=4.0.0", "rpi-lgpio", "sysv_ipc>=1.1.0"]
41     if b"amlogic,a311d" in compat:
42         board_reqs = ["sysv_ipc>=1.1.0"]
43     if (
44         b"ti,am335x" in compat
45     ):  # BeagleBone Black, Green, PocketBeagle, BeagleBone AI, etc.
46         board_reqs = ["Adafruit_BBIO"]
47
48 setup(
49     name="Adafruit-Blinka",
50     use_scm_version={
51         # This is needed for the PyPI version munging in the Github Actions release.yml
52         "git_describe_command": "git describe --tags --long",
53         "local_scheme": "no-local-version",
54     },
55     setup_requires=["setuptools_scm"],
56     description="CircuitPython APIs for non-CircuitPython versions of Python such as CPython on Linux and MicroPython.",
57     long_description=long_description,
58     long_description_content_type="text/x-rst",
59     author="Adafruit Industries",
60     author_email="circuitpython@adafruit.com",
61     python_requires=">=3.7.0",
62     url="https://github.com/adafruit/Adafruit_Blinka",
63     package_dir={"": "src"},
64     packages=find_packages("src") + ["micropython-stubs"],
65     # py_modules lists top-level single file packages to include.
66     # find_packages only finds packages in directories with __init__.py files.
67     py_modules=[
68         "analogio",
69         "bitbangio",
70         "board",
71         "busio",
72         "digitalio",
73         "keypad",
74         "micropython",
75         "neopixel_write",
76         "onewireio",
77         "pulseio",
78         "pwmio",
79         "rainbowio",
80         "usb_hid",
81     ],
82     package_data={
83         "adafruit_blinka.microcontroller.bcm283x.pulseio": [
84             "libgpiod_pulsein",
85             "libgpiod_pulsein64",
86         ],
87         "adafruit_blinka.microcontroller.amlogic.meson_g12_common.pulseio": [
88             "libgpiod_pulsein",
89         ],
90         "micropython-stubs": ["*.pyi"],
91     },
92     include_package_data=True,
93     install_requires=[
94         "Adafruit-PlatformDetect>=3.70.1",
95         "Adafruit-PureIO>=1.1.7",
96         "binho-host-adapter>=0.1.6",
97         "pyftdi>=0.40.0",
98         "numpy>=1.21.5",
99         "adafruit-circuitpython-typing",
100     ]
101     + board_reqs,
102     license="MIT",
103     classifiers=[
104         # Trove classifiers
105         # Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
106         "License :: OSI Approved :: MIT License",
107         "Programming Language :: Python",
108         "Programming Language :: Python :: 3",
109         "Programming Language :: Python :: 3.7",
110         "Programming Language :: Python :: Implementation :: MicroPython",
111     ],
112 )