This repository was archived by the owner on Nov 19, 2020. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11Change Log
22==========
33
4+ v1.2.1
5+ ------
6+ - Fixed `set_blocking` bug (issue #2).
7+ - Added nonblocking tests.
8+ - Added python-dev and python3-dev to README.
9+
410v1.2.0
511------
612- Added version file.
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ Building and Installing
5959If you want to install manually then you may also need to install
6060cython and some dev libraries:
6161
62- $ sudo aptitude install liblircclient-dev cython gcc
62+ $ sudo aptitude install python{,3}-dev liblircclient-dev cython gcc
6363
6464Download, compile and install for Python 3 and 2.
6565
Original file line number Diff line number Diff line change @@ -187,7 +187,8 @@ def nextcode():
187187 free (code )
188188 raise NextCodeError ("There was an error reading the next code." )
189189 if code == NULL :
190- raise NextCodeError ("There was no complete code available." )
190+ # raise NextCodeError("There was no complete code available.")
191+ return list ()
191192
192193 # get all of the strings associated with this code
193194 strings = list ()
@@ -206,12 +207,8 @@ def set_blocking(blocking, lirc_socket):
206207 """Sets whether the nextcode function blocks"""
207208 fcntl .fcntl (lirc_socket , fcntl .F_SETOWN , unistd .getpid ())
208209 flags = fcntl .fcntl (lirc_socket , fcntl .F_GETFL , 0 )
209- if (flags == 0 ):
210- fcntl .fcntl (
211- lirc_socket ,
212- fcntl .F_SETFL ,
213- (flags & ~ fcntl .O_NONBLOCK ) | (0 if blocking else fcntl .O_NONBLOCK )
214- )
210+ flags = (flags & ~ fcntl .O_NONBLOCK ) | (0 if blocking else fcntl .O_NONBLOCK )
211+ fcntl .fcntl (lirc_socket , fcntl .F_SETFL , flags )
215212
216213
217214def _is_init_or_error ():
Original file line number Diff line number Diff line change 1212
1313setup (
1414 name = 'python-lirc' ,
15- version = '1.2.0 ' ,
15+ version = '1.2.1 ' ,
1616 description = 'Python bindings for LIRC.' ,
1717 author = 'Thomas Preston' ,
1818 author_email = 'thomasmarkpreston@gmail.com' ,
Original file line number Diff line number Diff line change 1+ import os
2+ import sys
3+ import time
14import unittest
5+ parentdir = os .path .dirname (os .path .dirname (os .path .abspath (__file__ )))
6+ sys .path .insert (0 , parentdir + "/build/lib.linux-armv6l-3.2/" )
27import lirc
3- import time
48
59
610class TestNextCode (unittest .TestCase ):
@@ -22,11 +26,20 @@ def setUp(self):
2226 lirc .init ("lirctest" , "tests/lircrc.test" , blocking = False )
2327
2428 def test_nonblocking_nextcode (self ):
29+ print ("Don't press anything yet..." )
30+ start_time = time .time ()
31+ end_time = start_time + 1 # 1 second in the future
32+ pressed = False
33+ while not pressed and time .time () < end_time :
34+ if lirc .nextcode () == ["horses" ]:
35+ pressed = True
36+ self .assertFalse (pressed )
37+
2538 print ("Press 1 on your remote." )
2639 start_time = time .time ()
2740 end_time = start_time + 5 # 5 seconds in the future
2841 pressed = False
29- while not pressed or time .time () < end_time :
42+ while not pressed and time .time () < end_time :
3043 if lirc .nextcode () == ["horses" ]:
3144 pressed = True
3245 self .assertTrue (pressed )
You can’t perform that action at this time.
0 commit comments