forked from platformio/platformio-core
List multicast DNS services only when PY3
This commit is contained in:
@ -24,7 +24,6 @@ from functools import wraps
|
|||||||
from glob import glob
|
from glob import glob
|
||||||
|
|
||||||
import click
|
import click
|
||||||
import zeroconf
|
|
||||||
|
|
||||||
from platformio import __version__, compat, exception, proc
|
from platformio import __version__, compat, exception, proc
|
||||||
from platformio.compat import PY2, WINDOWS
|
from platformio.compat import PY2, WINDOWS
|
||||||
@ -165,6 +164,9 @@ def get_logical_devices():
|
|||||||
def get_mdns_services():
|
def get_mdns_services():
|
||||||
compat.ensure_python3()
|
compat.ensure_python3()
|
||||||
|
|
||||||
|
# pylint: disable=import-outside-toplevel
|
||||||
|
import zeroconf
|
||||||
|
|
||||||
class mDNSListener(object):
|
class mDNSListener(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._zc = zeroconf.Zeroconf(interfaces=zeroconf.InterfaceChoice.All)
|
self._zc = zeroconf.Zeroconf(interfaces=zeroconf.InterfaceChoice.All)
|
||||||
@ -186,9 +188,6 @@ def get_mdns_services():
|
|||||||
def __exit__(self, etype, value, traceback):
|
def __exit__(self, etype, value, traceback):
|
||||||
self._zc.close()
|
self._zc.close()
|
||||||
|
|
||||||
def remove_service(self, zc, type_, name):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def add_service(self, zc, type_, name):
|
def add_service(self, zc, type_, name):
|
||||||
try:
|
try:
|
||||||
assert zeroconf.service_type_name(name)
|
assert zeroconf.service_type_name(name)
|
||||||
@ -203,6 +202,12 @@ def get_mdns_services():
|
|||||||
if s:
|
if s:
|
||||||
self._found_services.append(s)
|
self._found_services.append(s)
|
||||||
|
|
||||||
|
def remove_service(self, zc, type_, name):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def update_service(self, zc, type_, name):
|
||||||
|
pass
|
||||||
|
|
||||||
def get_services(self):
|
def get_services(self):
|
||||||
return self._found_services
|
return self._found_services
|
||||||
|
|
||||||
|
4
setup.py
4
setup.py
@ -36,9 +36,11 @@ minimal_requirements = [
|
|||||||
"requests==2.*",
|
"requests==2.*",
|
||||||
"semantic_version==2.8.*",
|
"semantic_version==2.8.*",
|
||||||
"tabulate==0.8.*",
|
"tabulate==0.8.*",
|
||||||
"zeroconf==%s" % ("0.19.*" if PY2 else "0.28.*"),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if not PY2:
|
||||||
|
minimal_requirements.append("zeroconf==0.28.*")
|
||||||
|
|
||||||
home_requirements = [
|
home_requirements = [
|
||||||
"aiofiles==0.6.*",
|
"aiofiles==0.6.*",
|
||||||
"json-rpc==1.13.*",
|
"json-rpc==1.13.*",
|
||||||
|
Reference in New Issue
Block a user