From 05a0ce953eba091b0d68d198be3048cc315f385f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Thu, 21 Jun 2018 17:35:51 +0200 Subject: [PATCH] Checking if node exists before building the web UI from PlatformIO --- code/extra_scripts.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/code/extra_scripts.py b/code/extra_scripts.py index 2b2437ad..9b65c0db 100644 --- a/code/extra_scripts.py +++ b/code/extra_scripts.py @@ -8,6 +8,8 @@ from subprocess import call import click from platformio import util +import distutils.spawn + Import("env") # ------------------------------------------------------------------------------ @@ -81,10 +83,13 @@ def check_size(source, target, env): print_filler("*", color=Color.LIGHT_YELLOW, err=True) def build_webui(env): - config = util.load_project_config() - kv = dict(config.items("env:" + env.get('PIOENV'))) - modules = kv["modules"] if "modules" in kv else "all" - env.Execute("WEBUI_MODULES=\"%s\" node node_modules/gulp/bin/gulp.js" % modules) + if distutils.spawn.find_executable("node"): + config = util.load_project_config() + kv = dict(config.items("env:" + env.get('PIOENV'))) + modules = kv["modules"] if "modules" in kv else "all" + env.Execute("WEBUI_MODULES=\"%s\" node node_modules/gulp/bin/gulp.js" % modules) + else: + print_warning("Not building the web UI image ('node' does not exist in the path)") # ------------------------------------------------------------------------------ # Hooks