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