Skip to content

Commit 8042cc6

Browse files
committed
Fix notifications example on Python 2
1 parent ee7d9fc commit 8042cc6

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ differ from the ones given here. The reference commands are for Ubuntu.
5555
```bash
5656
# libx11-dev is for the AmbiLight and notifications examples
5757
# python3-gtk2.0 is for the notifications example
58-
sudo apt-get install cmake libusb-1.0.0-dev libx11-dev python3-gtk2.0
58+
sudo apt-get install cmake libusb-1.0.0-dev libx11-dev
5959
cd Source/masterkeys-linux # Or wherever you have cloned the repo
6060

6161
# Builds library, utilities and C examples
@@ -65,7 +65,8 @@ make
6565
sudo make install
6666

6767
# For the Python library (system-wide install) and Python examples
68-
sudo python -m pip install scikit-build
68+
sudo python -m pip install scikit-build # Needed for building
69+
sudo python -m pip install PyGObject dbus-python # Notifications example
6970
sudo python setup.py build install # Python examples not installed
7071

7172
# Or if you would rather install from PyPI, still requires dependencies

examples/notifications/mk_notifications.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,6 @@ static struct PyMethodDef mk_notifications_funcs[] = {{
307307

308308
#if PY_MAJOR_VERSION < 3
309309
PyMODINIT_FUNC initmk_notifications(void) {
310-
mk_notifications_init(NULL, NULL);
311310
(void) Py_InitModule("mk_notifications", mk_notifications_funcs);
312311
}
313312
#else // PY_MAJOR_VERSION >= 3

setup.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ class BuildCommand(build):
2424
"""Intercept the build command to copy modules"""
2525
def run(self):
2626
build.run(self)
27-
source = os.path.join("./_skbuild/linux*/cmake-build/*notifications.so*")
27+
if len(glob.glob("./_skbuild/linux*")) != 0:
28+
source = os.path.join("./_skbuild/linux*/cmake-build/*notifications.so*")
29+
else:
30+
source = os.path.join("./_skbuild/cmake-build/*notifications.so*")
2831
target = os.path.join("./examples/notifications/mk_notifications.so")
2932
copyfile(glob.glob(source)[0], target)
3033

0 commit comments

Comments
 (0)