mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 10:07:14 +02:00
Shutdown PIO Home server before updating tool-pioplus
; Update tool-pioplus
to 1.4.11
This commit is contained in:
@ -15,7 +15,6 @@
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
import click
|
import click
|
||||||
import requests
|
|
||||||
|
|
||||||
from platformio.managers.core import pioplus_call
|
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)
|
@click.option("--no-open", is_flag=True)
|
||||||
def cli(*args, **kwargs): # pylint: disable=unused-argument
|
def cli(*args, **kwargs): # pylint: disable=unused-argument
|
||||||
pioplus_call(sys.argv[1:])
|
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
|
|
||||||
|
@ -20,7 +20,7 @@ import click
|
|||||||
import requests
|
import requests
|
||||||
|
|
||||||
from platformio import VERSION, __version__, exception, util
|
from platformio import VERSION, __version__, exception, util
|
||||||
from platformio.commands.home import shutdown_servers
|
from platformio.managers.core import shutdown_piohome_servers
|
||||||
|
|
||||||
|
|
||||||
@click.command(
|
@click.command(
|
||||||
@ -36,7 +36,7 @@ def cli(dev):
|
|||||||
click.secho("Please wait while upgrading PlatformIO ...", fg="yellow")
|
click.secho("Please wait while upgrading PlatformIO ...", fg="yellow")
|
||||||
|
|
||||||
# kill all PIO Home servers, they block `pioplus` binary
|
# 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 != ".")
|
to_develop = dev or not all(c.isdigit() for c in __version__ if c != ".")
|
||||||
cmds = (["pip", "install", "--upgrade",
|
cmds = (["pip", "install", "--upgrade",
|
||||||
|
@ -17,13 +17,15 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
from os.path import dirname, join
|
from os.path import dirname, join
|
||||||
|
|
||||||
|
import requests
|
||||||
|
|
||||||
from platformio import __version__, exception, util
|
from platformio import __version__, exception, util
|
||||||
from platformio.managers.package import PackageManager
|
from platformio.managers.package import PackageManager
|
||||||
|
|
||||||
CORE_PACKAGES = {
|
CORE_PACKAGES = {
|
||||||
"contrib-piohome": "^1.0.2",
|
"contrib-piohome": "^1.0.2",
|
||||||
"contrib-pysite": ">=0.3.2,<2",
|
"contrib-pysite": ">=0.3.2,<2",
|
||||||
"tool-pioplus": "^1.4.5",
|
"tool-pioplus": "^1.4.11",
|
||||||
"tool-unity": "~1.20403.0",
|
"tool-unity": "~1.20403.0",
|
||||||
"tool-scons": "~2.20501.4"
|
"tool-scons": "~2.20501.4"
|
||||||
}
|
}
|
||||||
@ -92,10 +94,22 @@ def update_core_packages(only_check=False, silent=False):
|
|||||||
if not pkg_dir:
|
if not pkg_dir:
|
||||||
continue
|
continue
|
||||||
if not silent or pm.outdated(pkg_dir, requirements):
|
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)
|
pm.update(name, requirements, only_check=only_check)
|
||||||
return True
|
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):
|
def pioplus_call(args, **kwargs):
|
||||||
if "windows" in util.get_systype() and sys.version_info < (2, 7, 6):
|
if "windows" in util.get_systype() and sys.version_info < (2, 7, 6):
|
||||||
raise exception.PlatformioException(
|
raise exception.PlatformioException(
|
||||||
|
Reference in New Issue
Block a user