Shutdown PIO Home server before updating tool-pioplus; Update tool-pioplus to 1.4.11

This commit is contained in:
Ivan Kravets
2018-10-25 13:44:41 +03:00
parent 7cc4e8ce15
commit 3507290a20
3 changed files with 17 additions and 14 deletions

View File

@ -15,7 +15,6 @@
import sys
import click
import requests
from platformio.managers.core import pioplus_call
@ -30,13 +29,3 @@ from platformio.managers.core import pioplus_call
@click.option("--no-open", is_flag=True)
def cli(*args, **kwargs): # pylint: disable=unused-argument
pioplus_call(sys.argv[1:])
def shutdown_servers():
port = 8010
while port < 9000:
try:
requests.get("http://127.0.0.1:%d?__shutdown__=1" % port)
port += 1
except: # pylint: disable=bare-except
return

View File

@ -20,7 +20,7 @@ import click
import requests
from platformio import VERSION, __version__, exception, util
from platformio.commands.home import shutdown_servers
from platformio.managers.core import shutdown_piohome_servers
@click.command(
@ -36,7 +36,7 @@ def cli(dev):
click.secho("Please wait while upgrading PlatformIO ...", fg="yellow")
# kill all PIO Home servers, they block `pioplus` binary
shutdown_servers()
shutdown_piohome_servers()
to_develop = dev or not all(c.isdigit() for c in __version__ if c != ".")
cmds = (["pip", "install", "--upgrade",

View File

@ -17,13 +17,15 @@ import subprocess
import sys
from os.path import dirname, join
import requests
from platformio import __version__, exception, util
from platformio.managers.package import PackageManager
CORE_PACKAGES = {
"contrib-piohome": "^1.0.2",
"contrib-pysite": ">=0.3.2,<2",
"tool-pioplus": "^1.4.5",
"tool-pioplus": "^1.4.11",
"tool-unity": "~1.20403.0",
"tool-scons": "~2.20501.4"
}
@ -92,10 +94,22 @@ def update_core_packages(only_check=False, silent=False):
if not pkg_dir:
continue
if not silent or pm.outdated(pkg_dir, requirements):
if name == "tool-pioplus" and not only_check:
shutdown_piohome_servers()
pm.update(name, requirements, only_check=only_check)
return True
def shutdown_piohome_servers():
port = 8010
while port < 9000:
try:
requests.get("http://127.0.0.1:%d?__shutdown__=1" % port)
port += 1
except: # pylint: disable=bare-except
return
def pioplus_call(args, **kwargs):
if "windows" in util.get_systype() and sys.version_info < (2, 7, 6):
raise exception.PlatformioException(