Ensure dependent packages for PIO Home are installed

This commit is contained in:
Ivan Kravets
2022-12-15 20:01:28 +02:00
parent a0387bd16e
commit 6395a032e5

View File

@ -18,6 +18,7 @@ import click
from platformio.home.helpers import is_port_used from platformio.home.helpers import is_port_used
from platformio.home.run import run_server from platformio.home.run import run_server
from platformio.package.manager.core import get_core_package_dir
@click.command("home", short_help="GUI to manage PlatformIO") @click.command("home", short_help="GUI to manage PlatformIO")
@ -48,15 +49,17 @@ from platformio.home.run import run_server
), ),
) )
def cli(port, host, no_open, shutdown_timeout, session_id): def cli(port, host, no_open, shutdown_timeout, session_id):
# hook for `platformio-node-helpers`
if host == "__do_not_start__":
# download all dependent packages
get_core_package_dir("contrib-piohome")
return
# Ensure PIO Home mimetypes are known # Ensure PIO Home mimetypes are known
mimetypes.add_type("text/html", ".html") mimetypes.add_type("text/html", ".html")
mimetypes.add_type("text/css", ".css") mimetypes.add_type("text/css", ".css")
mimetypes.add_type("application/javascript", ".js") mimetypes.add_type("application/javascript", ".js")
# hook for `platformio-node-helpers`
if host == "__do_not_start__":
return
home_url = "http://%s:%d%s" % ( home_url = "http://%s:%d%s" % (
host, host,
port, port,