X Tutup
Skip to content

Commit 8bf397b

Browse files
committed
Python 2 related fixes
1 parent ac96a90 commit 8bf397b

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

evdev/evtest.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@
2929
import termios
3030
import optparse
3131

32+
try:
33+
input = raw_input
34+
except NameError:
35+
pass
36+
3237
from evdev import ecodes, list_devices, AbsInfo, InputDevice
3338

3439

@@ -105,6 +110,9 @@ def devicenum(device_path):
105110
choices = choices.split()
106111
choices = [devices[int(num)] for num in choices]
107112
except ValueError:
113+
choices = None
114+
115+
if not choices:
108116
msg = 'error: invalid input - please enter one or more numbers separated by spaces'
109117
print(msg, file=sys.stderr)
110118
sys.exit(1)

setup.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,16 +112,17 @@ class cmdbuild_ext(build_ext.build_ext):
112112

113113
def initialize_options(self):
114114
self.evdev_headers = None
115-
super(cmdbuild_ext, self).initialize_options()
115+
# We cannot use super(cmdbuild_ext, self) here for compatibility with Py2.
116+
build_ext.build_ext.initialize_options(self)
116117

117118
def finalize_options(self):
118119
if self.evdev_headers:
119120
self.evdev_headers = self.evdev_headers.split(':')
120-
super(cmdbuild_ext, self).finalize_options()
121+
build_ext.build_ext.finalize_options(self)
121122

122123
def run(self):
123124
create_ecodes(self.evdev_headers)
124-
super(cmdbuild_ext, self).run()
125+
build_ext.build_ext.run(self)
125126

126127
#-----------------------------------------------------------------------------
127128
kw['cmdclass']['build_ext'] = cmdbuild_ext

0 commit comments

Comments
 (0)
X Tutup