Skip to content

Commit c60d2c2

Browse files
committed
Merge pull request gpiozero#335 from lurch/patch-1
Fix Travis-build Recipe
2 parents 2bd1cbc + fa440bb commit c60d2c2

File tree

1 file changed

+19
-22
lines changed

1 file changed

+19
-22
lines changed

docs/recipes.rst

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -326,28 +326,25 @@ Travis build LED indicator
326326
Use LEDs to indicate the status of a Travis build. A green light means the
327327
tests are passing, a red light means the build is broken::
328328

329-
from travispy import TravisPy
330-
from gpiozero import LED
331-
from time import sleep
332-
from signal import pause
333-
334-
def build_passed(repo='RPi-Distro/python-gpiozero', delay=3600):
335-
t = TravisPy()
336-
r = t.repo(repo)
337-
while True:
338-
yield r.last_build_state == 'passed'
339-
sleep(delay) # Sleep an hour before hitting travis again
340-
341-
def invert(values):
342-
for value in values:
343-
yield not value
344-
345-
red = LED(12)
346-
green = LED(16)
347-
348-
red.source = invert(green.values)
349-
green.source = build_passed()
350-
pause()
329+
from travispy import TravisPy
330+
from gpiozero import LED
331+
from gpiozero.tools import negated
332+
from time import sleep
333+
from signal import pause
334+
335+
def build_passed(repo='RPi-Distro/python-gpiozero', delay=3600):
336+
t = TravisPy()
337+
r = t.repo(repo)
338+
while True:
339+
yield r.last_build_state == 'passed'
340+
sleep(delay) # Sleep an hour before hitting travis again
341+
342+
red = LED(12)
343+
green = LED(16)
344+
345+
red.source = negated(green.values)
346+
green.source = build_passed()
347+
pause()
351348

352349

353350
Note this recipe requires travispy. Install with ``sudo pip3 install travispy``.

0 commit comments

Comments
 (0)