1
0
mirror of https://github.com/s00500/ESPUI.git synced 2024-11-25 03:50:54 +00:00

Added helpful hints in case of missing python modules to prepare_static_ui_sources.py

This commit is contained in:
Dave Kliczbor 2018-12-01 18:41:40 +01:00
parent a56f5decc7
commit bec4eb1c0f

View File

@ -1,15 +1,37 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from jsmin import jsmin as jsminify
from htmlmin import minify as htmlminify
from csscompressor import compress as cssminify
import gzip
import sys import sys
import os.path import os.path
import argparse import argparse
import re import re
from glob import glob from glob import glob
missing = []
try:
from jsmin import jsmin as jsminify
except ModuleNotFoundError as e:
missing.append(e)
try:
from htmlmin import minify as htmlminify
except ModuleNotFoundError as e:
missing.append(e)
try:
from csscompressor import compress as cssminify
except ModuleNotFoundError as e:
missing.append(e)
try:
import gzip
except ModuleNotFoundError as e:
missing.append(e)
if len(missing) > 0:
for m in missing:
print("Cannot find module '%s'." % m.name)
print("Can't find %s required python module%s. Please install %s. If you're not sure how, a web search" % (len(missing), "s" if len(missing) > 1 else "", "them" if len(missing) > 1 else "it"))
print("for 'python', your operating system/python distribution and 'install modules' should help.")
print("For most people on unix-y systems, this line should work (possibly w/o the '3'):\n pip3 install %s" % " ".join(m.name for m in missing))
print("Here's the long documentation: https://packaging.python.org/tutorials/installing-packages/")
sys.exit(0)
TARGET_TEMPLATE = '''const char {constant}[] PROGMEM = R"=====( TARGET_TEMPLATE = '''const char {constant}[] PROGMEM = R"=====(
{minidata} {minidata}
)====="; )=====";