forked from sidoh/esp8266_milight_hub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.build_web.py
34 lines (29 loc) · 872 Bytes
/
.build_web.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from shutil import copyfile
from subprocess import check_output
import sys
import os
import platform
import subprocess
Import("env")
def is_tool(name):
cmd = "where" if platform.system() == "Windows" else "which"
try:
check_output([cmd, name])
return True
except:
return False;
def build_web():
if is_tool("npm"):
os.chdir("web")
print("Attempting to build webpage...")
try:
print check_output(["npm", "install"])
print check_output(["node_modules/.bin/gulp"])
copyfile("build/index.html.gz.h", "../dist/index.html.gz.h")
except Exception as e:
print "Encountered error building webpage: ", e
print "WARNING: Failed to build web package. Using pre-built page."
pass
finally:
os.chdir("..");
build_web()