Import the "zeroconf" module only when a user lists mDNS devices (issue with zeroconf's LGPL license)

This commit is contained in:
Ivan Kravets
2022-11-05 12:03:06 +02:00
parent 32c2e33edf
commit ca7a100392
2 changed files with 4 additions and 2 deletions

View File

@ -16,6 +16,8 @@ PlatformIO Core 6
6.1.6 (2022-??-??) 6.1.6 (2022-??-??)
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
* Import the "zeroconf" module only when a user lists mDNS devices (issue with zeroconf's LGPL license)
6.1.5 (2022-11-01) 6.1.5 (2022-11-01)
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~

View File

@ -18,8 +18,6 @@ import re
import time import time
from glob import glob from glob import glob
import zeroconf
from platformio import __version__, exception, proc from platformio import __version__, exception, proc
from platformio.compat import IS_MACOS, IS_WINDOWS from platformio.compat import IS_MACOS, IS_WINDOWS
@ -84,6 +82,8 @@ def list_logical_devices():
def list_mdns_services(): def list_mdns_services():
import zeroconf
class mDNSListener: class mDNSListener:
def __init__(self): def __init__(self):
self._zc = zeroconf.Zeroconf(interfaces=zeroconf.InterfaceChoice.All) self._zc = zeroconf.Zeroconf(interfaces=zeroconf.InterfaceChoice.All)