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