forked from platformio/platformio-core
Depend on "zeroconf" from "contrib-pysite"
This commit is contained in:
@ -227,10 +227,3 @@ 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"
|
|
||||||
|
@ -22,7 +22,7 @@ from platformio.managers.package import PackageManager
|
|||||||
|
|
||||||
CORE_PACKAGES = {
|
CORE_PACKAGES = {
|
||||||
"contrib-piohome": ">=0.5.3,<2",
|
"contrib-piohome": ">=0.5.3,<2",
|
||||||
"pysite-pioplus": ">=0.4.2,<2",
|
"contrib-pysite": ">=0.1.0,<2",
|
||||||
"tool-pioplus": ">=0.12.1,<2",
|
"tool-pioplus": ">=0.12.1,<2",
|
||||||
"tool-unity": "~1.20302.1",
|
"tool-unity": "~1.20302.1",
|
||||||
"tool-scons": "~3.20501.2"
|
"tool-scons": "~3.20501.2"
|
||||||
@ -105,7 +105,7 @@ def pioplus_call(args, **kwargs):
|
|||||||
pioplus_path = join(get_core_package_dir("tool-pioplus"), "pioplus")
|
pioplus_path = join(get_core_package_dir("tool-pioplus"), "pioplus")
|
||||||
pythonexe_path = util.get_pythonexe_path()
|
pythonexe_path = util.get_pythonexe_path()
|
||||||
os.environ['PYTHONEXEPATH'] = pythonexe_path
|
os.environ['PYTHONEXEPATH'] = pythonexe_path
|
||||||
os.environ['PYTHONPYSITEDIR'] = get_core_package_dir("pysite-pioplus")
|
os.environ['PYTHONPYSITEDIR'] = get_core_package_dir("contrib-pysite")
|
||||||
os.environ['PATH'] = (os.pathsep).join(
|
os.environ['PATH'] = (os.pathsep).join(
|
||||||
[dirname(pythonexe_path), os.environ['PATH']])
|
[dirname(pythonexe_path), os.environ['PATH']])
|
||||||
util.copy_pythonpath_to_osenv()
|
util.copy_pythonpath_to_osenv()
|
||||||
|
@ -495,7 +495,12 @@ def get_mdns_services():
|
|||||||
try:
|
try:
|
||||||
import zeroconf
|
import zeroconf
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise exception.ZeroconfIsNotInstalled()
|
from site import addsitedir
|
||||||
|
from platformio.managers.core import get_core_package_dir
|
||||||
|
contrib_pysite_dir = get_core_package_dir("contrib-pysite")
|
||||||
|
addsitedir(contrib_pysite_dir)
|
||||||
|
sys.path.insert(0, contrib_pysite_dir)
|
||||||
|
import zeroconf
|
||||||
|
|
||||||
class mDNSListener(object):
|
class mDNSListener(object):
|
||||||
|
|
||||||
|
16
setup.py
16
setup.py
@ -12,9 +12,6 @@
|
|||||||
# 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__,
|
||||||
@ -30,19 +27,6 @@ install_requires = [
|
|||||||
"requests>=2.4.0,<3",
|
"requests>=2.4.0,<3",
|
||||||
"semantic_version>=2.5.0,<3"
|
"semantic_version>=2.5.0,<3"
|
||||||
]
|
]
|
||||||
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