mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 01:57:13 +02:00
Check zeroconf installation before adding to setuptools
This commit is contained in:
@ -227,3 +227,10 @@ class CygwinEnvDetected(PlatformioException):
|
|||||||
|
|
||||||
MESSAGE = "PlatformIO does not work within Cygwin environment. "\
|
MESSAGE = "PlatformIO does not work within Cygwin environment. "\
|
||||||
"Use native Terminal instead."
|
"Use native Terminal instead."
|
||||||
|
|
||||||
|
|
||||||
|
class ZeroconfIsNotInstalled(PlatformioException):
|
||||||
|
|
||||||
|
MESSAGE = "Python multicast DNS service discovery library has not been "\
|
||||||
|
"installed automatically. Please open terminal and run \n"\
|
||||||
|
"> pip install zeroconf"
|
||||||
|
@ -32,7 +32,6 @@ from time import sleep, time
|
|||||||
|
|
||||||
import click
|
import click
|
||||||
import requests
|
import requests
|
||||||
import zeroconf
|
|
||||||
|
|
||||||
from platformio import __apiurl__, __version__, exception
|
from platformio import __apiurl__, __version__, exception
|
||||||
|
|
||||||
@ -493,6 +492,10 @@ get_logicaldisks = lambda: [{
|
|||||||
|
|
||||||
|
|
||||||
def get_mdns_services():
|
def get_mdns_services():
|
||||||
|
try:
|
||||||
|
import zeroconf
|
||||||
|
except ImportError:
|
||||||
|
raise exception.ZeroconfIsNotInstalled()
|
||||||
|
|
||||||
class mDNSListener(object):
|
class mDNSListener(object):
|
||||||
|
|
||||||
|
19
setup.py
19
setup.py
@ -12,6 +12,9 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
from os.path import normpath
|
||||||
from setuptools import find_packages, setup
|
from setuptools import find_packages, setup
|
||||||
|
|
||||||
from platformio import (__author__, __description__, __email__, __license__,
|
from platformio import (__author__, __description__, __email__, __license__,
|
||||||
@ -25,9 +28,21 @@ install_requires = [
|
|||||||
"lockfile>=0.9.1,<0.13",
|
"lockfile>=0.9.1,<0.13",
|
||||||
"pyserial>=3,<4,!=3.3",
|
"pyserial>=3,<4,!=3.3",
|
||||||
"requests>=2.4.0,<3",
|
"requests>=2.4.0,<3",
|
||||||
"semantic_version>=2.5.0,<3",
|
"semantic_version>=2.5.0,<3"
|
||||||
"zeroconf<=0.19.1"
|
|
||||||
]
|
]
|
||||||
|
zeroconf_requirement = "zeroconf<=0.19.1"
|
||||||
|
|
||||||
|
try:
|
||||||
|
import zeroconf # pylint: disable=unused-import
|
||||||
|
except ImportError:
|
||||||
|
try:
|
||||||
|
subprocess.check_call([
|
||||||
|
normpath(sys.executable), "-m", "pip", "install",
|
||||||
|
zeroconf_requirement
|
||||||
|
])
|
||||||
|
install_requires.append(zeroconf_requirement)
|
||||||
|
except: # pylint: disable=bare-except
|
||||||
|
pass
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name=__title__,
|
name=__title__,
|
||||||
|
Reference in New Issue
Block a user