Skip to content

Commit

Permalink
Check for gulp.js too. Warn about node and gulp.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcspr committed Jun 22, 2018
1 parent 1a35f03 commit d750b53
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions code/extra_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ def print_filler(fill, color=Color.WHITE, err=False):
out = sys.stderr if err else sys.stdout
print(clr(color, fill * width), file=out)

def VerboseWhereIs(env, prog, message, path=None):
result = env.WhereIs(prog=prog, path=path)
if not result:
if path:
prog = os.path.join(path, prog)
print_warning("'{}' {}".format(prog, message))
return result
env.AddMethod(VerboseWhereIs)

# ------------------------------------------------------------------------------
# Callbacks
# ------------------------------------------------------------------------------
Expand Down Expand Up @@ -109,14 +118,24 @@ def build_webui(source, target, env):
env.Append(WEBUI_SOURCE="$PROJECT_DIR/html/")
env.Append(WEBUI_HEADER="$PROJECT_DIR/espurna/static/index.html.gz.h")

# check env.WhereIs("node_modules/gulp/bin/gulp.js") too
if env.WhereIs("node"):
have_node = env.VerboseWhereIs(
"node",
"is not installed"
)

have_gulp = env.VerboseWhereIs(
"gulp.js",
"is not installed (run 'npm install --only=dev')",
"node_modules/gulp/bin/"
)

if have_node and have_gulp:
env.Depends("$WEBUI_HEADER", "$WEBUI_SOURCE")
env.Depends(env.Alias("buildprog"), "$WEBUI_HEADER")
cmd_webui = env.Command("$WEBUI_HEADER", "$WEBUI_SOURCE",
build_webui, source_scanner=DirScanner())
env.AlwaysBuild(env.Alias("build_webui", cmd_webui))
else:
print_warning("Not building the web UI image ('node' does not exist in the path)")
print_warning("Not building the web UI bundle")

env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", check_size)

0 comments on commit d750b53

Please sign in to comment.