Skip to content

Commit c0b7baf

Browse files
committed
Change Setup.py to use elif statements to avoid doubling requirements
1 parent bbf328e commit c0b7baf

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

setup.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,29 @@
2424
if os.path.exists("/proc/device-tree/compatible"):
2525
with open("/proc/device-tree/compatible", "rb") as f:
2626
compat = f.read()
27+
# Jetson Nano, TX2, Xavier, etc
2728
if b"nvidia,tegra" in compat:
2829
board_reqs = ["Jetson.GPIO"]
30+
# Pi 5
31+
elif b"brcm,bcm2712" in compat:
32+
board_reqs = [
33+
"rpi_ws281x>=4.0.0",
34+
"rpi-lgpio",
35+
"Adafruit-Blinka-Raspberry-Pi5-Neopixel",
36+
]
2937
# Pi 4 and Earlier
30-
if (
38+
elif (
3139
b"brcm,bcm2835" in compat
3240
or b"brcm,bcm2836" in compat
3341
or b"brcm,bcm2837" in compat
3442
or b"brcm,bcm2838" in compat
3543
or b"brcm,bcm2711" in compat
3644
):
3745
board_reqs = ["RPi.GPIO", "rpi_ws281x>=4.0.0"]
38-
# Pi 5
39-
if b"brcm,bcm2712" in compat:
40-
board_reqs = [
41-
"rpi_ws281x>=4.0.0",
42-
"rpi-lgpio",
43-
"Adafruit-Blinka-Raspberry-Pi5-Neopixel",
44-
]
45-
if (
46+
# BeagleBone Black, Green, PocketBeagle, BeagleBone AI, etc.
47+
elif (
4648
b"ti,am335x" in compat
47-
): # BeagleBone Black, Green, PocketBeagle, BeagleBone AI, etc.
49+
):
4850
board_reqs = ["Adafruit_BBIO"]
4951

5052
setup(

0 commit comments

Comments
 (0)