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