blob: a99f0390d1e516c3b15c6d129e1d588e12c62f14 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
## common/zeroconf/zeroconf.py
##
## Copyright (C) 2006 Stefan Bethge <stefan@lanpartei.de>
##
## This file is part of Gajim.
##
## Gajim is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published
## by the Free Software Foundation; version 3 only.
##
## Gajim is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
##
C_NAME, C_DOMAIN, C_INTERFACE, C_PROTOCOL, C_HOST, \
C_ADDRESS, C_PORT, C_BARE_NAME, C_TXT = range(9)
def test_avahi():
try:
import avahi
except ImportError:
return False
return True
def test_bonjour():
try:
import pybonjour
except ImportError:
return False
except WindowsError:
return False
return True
def test_zeroconf():
return test_avahi() or test_bonjour()
if test_avahi():
from common.zeroconf import zeroconf_avahi
Zeroconf = zeroconf_avahi.Zeroconf
elif test_bonjour():
from common.zeroconf import zeroconf_bonjour
Zeroconf = zeroconf_bonjour.Zeroconf
# vim: se ts=3:
|