aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/pkgs/development/python-modules/libevdev
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/libevdev')
-rw-r--r--nixpkgs/pkgs/development/python-modules/libevdev/default.nix35
-rw-r--r--nixpkgs/pkgs/development/python-modules/libevdev/fix-paths.patch22
2 files changed, 57 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/libevdev/default.nix b/nixpkgs/pkgs/development/python-modules/libevdev/default.nix
new file mode 100644
index 00000000000..a17612c79cb
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/libevdev/default.nix
@@ -0,0 +1,35 @@
+{ stdenv
+, buildPythonPackage
+, isPy27
+, fetchPypi
+, substituteAll
+, pkgs
+, pytestCheckHook
+}:
+
+buildPythonPackage rec {
+ pname = "libevdev";
+ version = "0.9";
+ disabled = isPy27;
+
+ src = fetchPypi {
+ inherit pname version;
+ sha256 = "17agnigmzscmdjqmrylg1lza03hwjhgxbpf4l705s6i7p7ndaqrs";
+ };
+
+ patches = [
+ (substituteAll {
+ src = ./fix-paths.patch;
+ libevdev = stdenv.lib.getLib pkgs.libevdev;
+ })
+ ];
+
+ checkInputs = [ pytestCheckHook ];
+
+ meta = with stdenv.lib; {
+ description = "Python wrapper around the libevdev C library";
+ homepage = "https://gitlab.freedesktop.org/libevdev/python-libevdev";
+ license = licenses.mit;
+ maintainers = with maintainers; [ nickhu ];
+ };
+}
diff --git a/nixpkgs/pkgs/development/python-modules/libevdev/fix-paths.patch b/nixpkgs/pkgs/development/python-modules/libevdev/fix-paths.patch
new file mode 100644
index 00000000000..e73c360b146
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/libevdev/fix-paths.patch
@@ -0,0 +1,22 @@
+diff --git a/libevdev/_clib.py b/libevdev/_clib.py
+index 6e4ab2c..9db54d1 100644
+--- a/libevdev/_clib.py
++++ b/libevdev/_clib.py
+@@ -120,7 +120,7 @@ class Libevdev(_LibraryWrapper):
+
+ @staticmethod
+ def _cdll():
+- return ctypes.CDLL("libevdev.so.2", use_errno=True)
++ return ctypes.CDLL("@libevdev@/lib/libevdev.so.2", use_errno=True)
+
+ _api_prototypes = {
+ # const char *libevdev_event_type_get_name(unsigned int type);
+@@ -910,7 +910,7 @@ class UinputDevice(_LibraryWrapper):
+
+ @staticmethod
+ def _cdll():
+- return ctypes.CDLL("libevdev.so.2", use_errno=True)
++ return ctypes.CDLL("@libevdev@/lib/libevdev.so.2", use_errno=True)
+
+ _api_prototypes = {
+ # int libevdev_uinput_create_from_device(const struct libevdev *, int, struct libevdev_uinput **)