Browse Source

Checking if node exists before building the web UI from PlatformIO

rfm69
Xose Pérez 6 years ago
parent
commit
05a0ce953e
1 changed files with 9 additions and 4 deletions
  1. +9
    -4
      code/extra_scripts.py

+ 9
- 4
code/extra_scripts.py View File

@ -8,6 +8,8 @@ from subprocess import call
import click import click
from platformio import util from platformio import util
import distutils.spawn
Import("env") Import("env")
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@ -81,10 +83,13 @@ def check_size(source, target, env):
print_filler("*", color=Color.LIGHT_YELLOW, err=True) print_filler("*", color=Color.LIGHT_YELLOW, err=True)
def build_webui(env): 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 # Hooks


Loading…
Cancel
Save