From 5329190d9cf1d3f881d9bc70a1ee309c2d52ea6a Mon Sep 17 00:00:00 2001
From: Sebastiaan Lokhorst <sebastiaanlokhorst@gmail.com>
Date: Sat, 5 Jan 2019 16:30:03 +0100
Subject: [PATCH] Fix Bonjour (pybonjour) on macOS

---
 README.md           |  2 +-
 gajim/common/app.py | 14 ++++++++------
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/README.md b/README.md
index b8eb19c744..eb34f2bf80 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,7 @@
 
 - python3-pil (pillow) for support of webp avatars
 - python3-gnupg to enable GPG encryption
-- For zeroconf (bonjour) you need python3-dbus
+- For zeroconf you need python3-dbus on Linux or [pybonjour](https://dev.gajim.org/lovetox/pybonjour-python3) on Windows/macOS
 - gir1.2-gspell-1 and hunspell-LANG where lang is your locale eg. en, fr etc
 - gir1.2-secret-1 for GNOME Keyring or KDE support as password storage
 - D-Bus running to have gajim-remote working
diff --git a/gajim/common/app.py b/gajim/common/app.py
index 63b7e2e614..6fe8ce60ba 100644
--- a/gajim/common/app.py
+++ b/gajim/common/app.py
@@ -200,12 +200,14 @@ def detect_dependencies():
 
     # ZEROCONF
     try:
-        if os.name == 'nt':
-            import pybonjour  # pylint: disable=unused-variable
-            _dependencies['PYBONJOUR'] = True
-        else:
-            import dbus  # pylint: disable=unused-variable
-            _dependencies['PYTHON-DBUS'] = True
+        import pybonjour  # pylint: disable=unused-variable
+        _dependencies['PYBONJOUR'] = True
+    except Exception:
+        pass
+
+    try:
+        import dbus  # pylint: disable=unused-variable
+        _dependencies['PYTHON-DBUS'] = True
     except Exception:
         pass
 
-- 
GitLab