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