Skip to content

Commit 949aac8

Browse files
authored
Merge pull request #981 from makermelissa/main
Revert back to using setup.py to fix install problems
2 parents b595f89 + 8709862 commit 949aac8

File tree

6 files changed

+133
-89
lines changed

6 files changed

+133
-89
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ jobs:
1616
- name: Translate Repo Name For Build Tools filename_prefix
1717
id: repo-name
1818
run: echo "repo-name=Adafruit-Blinka" >> $GITHUB_OUTPUT
19-
- name: Set up Python 3.11
19+
- name: Set up Python 3.8
2020
uses: actions/setup-python@v4
2121
with:
22-
python-version: 3.11
22+
python-version: 3.8
2323
- name: Versions
2424
run: |
2525
python3 --version
@@ -47,12 +47,7 @@ jobs:
4747
- name: Build docs
4848
working-directory: docs
4949
run: sphinx-build -E -W -b html . _build/html
50-
- name: Check For pyproject.toml
51-
id: need-pypi
52-
run: |
53-
echo "pyproject-toml=$( find . -wholename './pyproject.toml' )" >> $GITHUB_OUTPUT
5450
- name: Build Python package
55-
if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
5651
run: |
5752
pip install --upgrade build twine
5853
for file in $(find -not -path "./.*" -not -path "./docs*" \( -name "*.py" -o -name "*.toml" \) ); do

.github/workflows/release.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,30 @@
22
#
33
# SPDX-License-Identifier: Unlicense
44
name: Release Actions
5-
65
on:
76
release:
87
types: [published]
9-
108
jobs:
119
upload-pypi:
1210
runs-on: ubuntu-latest
1311
steps:
1412
- uses: actions/checkout@v3
15-
- name: Check For pyproject.toml
13+
- name: Check For setup.py
1614
id: need-pypi
1715
run: |
18-
echo "pyproject-toml=$( find . -wholename './pyproject.toml' )" >> $GITHUB_OUTPUT
16+
echo "setup-py=$( find . -wholename './setup.py' )" >> $GITHUB_OUTPUT
1917
- name: Set up Python
20-
if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
18+
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
2119
uses: actions/setup-python@v4
2220
with:
23-
python-version: '3.11'
21+
python-version: '3.x'
2422
- name: Install dependencies
25-
if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
23+
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
2624
run: |
2725
python -m pip install --upgrade pip
2826
pip install --upgrade build twine
2927
- name: Build and publish
30-
if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
28+
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
3129
env:
3230
TWINE_USERNAME: ${{ secrets.pypi_username }}
3331
TWINE_PASSWORD: ${{ secrets.pypi_password }}

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
html_favicon = "_static/favicon.ico"
112112

113113
# Output file base name for HTML help builder.
114-
htmlhelp_basename = "Adafruit_blinkaDisplayioLibrarydoc"
114+
htmlhelp_basename = "AdafruitBlinkaLibrarydoc"
115115

116116
# -- Options for LaTeX output ---------------------------------------------
117117

pyproject.toml

Lines changed: 0 additions & 61 deletions
This file was deleted.

requirements.txt

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
Adafruit-PlatformDetect>=3.70.1
2-
Adafruit-PureIO>=1.1.7
3-
Jetson.GPIO; platform_machine=='aarch64'
4-
RPi.GPIO; platform_machine=='armv7l' or platform_machine=='armv6l' or platform_machine=='aarch64'
5-
rpi_ws281x>=4.0.0; platform_machine=='armv7l' or platform_machine=='armv6l' or platform_machine=='aarch64'
6-
sysv_ipc>=1.1.0; sys_platform == 'linux' and platform_machine!='mips'
7-
pyftdi>=0.40.0
8-
binho-host-adapter>=0.1.6
9-
adafruit-circuitpython-typing
10-
toml>=0.10.2; python_version<'3.11'
11-
lgpio>=0.2.2.0; sys_platform=='linux' and python_version<'3.13'
12-
Adafruit-Blinka-Raspberry-Pi5-Neopixel; platform_machine=='aarch64'
1+
# requirements.txt
2+
#
3+
# installs dependencies from ./setup.py, and the package itself,
4+
# in editable mode
5+
# -e .
6+
7+
# (the -e above is optional). you could also just install the package
8+
# normally with just the line below (after uncommenting)
9+
.

setup.py

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
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="[email protected]",
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+
)

0 commit comments

Comments
 (0)