We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 1c37e30 + 9e22407 commit a0eeb24Copy full SHA for a0eeb24
1 file changed
setup.py
@@ -2,12 +2,18 @@
2
from __future__ import with_statement
3
from __future__ import print_function
4
import re
5
+import os.path
6
7
from distutils.command.build_py import build_py as _build_py
8
from distutils.core import setup, Extension
9
10
def append_ev(ev_type, ev_name):
- with open("/usr/include/linux/input.h") as f:
11
+ # Newer kernels define events in different file
12
+ if os.path.exists("/usr/include/linux/input-event-codes.h"):
13
+ fpath = "/usr/include/linux/input-event-codes.h"
14
+ else:
15
+ fpath = "/usr/include/linux/input.h"
16
+ with open(fpath) as f:
17
with open("src/ev.py", "a") as f2:
18
for line in f:
19
match = re.match(r"^#define (" + ev_name + "_.*)\t+((?:0x[0-9a-f]+)|(?:\d+))", line)
0 commit comments