Skip to content

Commit f7dd579

Browse files
Compile libsuinput in build_ext step.
1 parent 350f4d4 commit f7dd579

3 files changed

Lines changed: 6 additions & 8 deletions

File tree

README

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,4 @@ General information
4040
Build requirements
4141
------------------
4242

43-
- Python (2.5, 2.6)
44-
45-
Runtime requirements
46-
--------------------
47-
48-
- [libsuinput4](http://tjjr.fi/software/libsuinput/)
43+
- libudev0

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
from distutils.core import setup
3+
from distutils.core import setup, Extension
44

55
setup(name='python-uinput',
66
version='0.5',
@@ -27,4 +27,6 @@
2727
device drivers into the Linux kernel. Python-uinput provides a
2828
pythonic API to the Linux uinput system.
2929
""",
30+
ext_modules=[Extension('_libsuinput', ['libsuinput/src/suinput.c'],
31+
libraries=["udev"])]
3032
)

src/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ def _error_handler(result, fn, args):
6666
raise RuntimeError("unexpected return value: %s" % result)
6767
return result
6868

69-
_libsuinput = ctypes.CDLL("libsuinput.so.4", use_errno=True)
69+
_libsuinput_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "_libsuinput.so"))
70+
_libsuinput = ctypes.CDLL(_libsuinput_path, use_errno=True)
7071
_libsuinput.suinput_open.errcheck = _error_handler
7172
_libsuinput.suinput_enable_event.errcheck = _error_handler
7273
_libsuinput.suinput_create.errcheck = _error_handler

0 commit comments

Comments
 (0)