Skip to content

Commit 5c8f430

Browse files
authored
Merge pull request #8 from RogueM/commit
re-adding RPi.GPIO to setup.py
2 parents ba39b2c + 7e0d8e3 commit 5c8f430

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

library/cap1xxx.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,21 @@
55
CAP1208 - 8 Inputs
66
CAP1188 - 8 Inputs, 8 LEDs
77
"""
8+
89
try:
910
from smbus import SMBus
1011
except ImportError:
11-
raise ImportError(
12-
"This library requires python-smbus. Install "
13-
"with: sudo apt-get install python-smbus or "
14-
"sudo apt-get install python3-smbus")
12+
if sys.version_info[0] < 3:
13+
exit("This library requires python-smbus\nInstall with: sudo apt-get install python-smbus")
14+
elif sys.version_info[0] == 3:
15+
exit("This library requires python3-smbus\nInstall with: sudo apt-get install python3-smbus")
16+
17+
try:
18+
import RPi.GPIO as GPIO
19+
except ImportError:
20+
exit("This library requires the RPi.GPIO module\nInstall with: sudo pip install RPi.GPIO")
1521

1622
import time, signal, atexit, sys, threading
17-
import RPi.GPIO as GPIO
1823

1924
# DEVICE MAP
2025
DEFAULT_ADDR = 0x28

library/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@
4646
url = 'http://shop.pimoroni.com',
4747
classifiers = classifiers,
4848
py_modules = ['cap1xxx'],
49-
install_requires= []
49+
install_requires= [ 'RPi.GPIO' ]
5050
)

0 commit comments

Comments
 (0)