mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
#506 use minified files for off-line installer
This commit is contained in:
parent
347f67c8ee
commit
df8c71f12e
@ -3,6 +3,9 @@ import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
path_prefix = "./_minified/"
|
||||
|
||||
# recursively encode files with base64
|
||||
def encode_recursive(path):
|
||||
list = {}
|
||||
|
||||
@ -18,11 +21,12 @@ def encode_recursive(path):
|
||||
|
||||
return list
|
||||
|
||||
# encode listed files with base64
|
||||
def encode_files(files):
|
||||
list = {}
|
||||
|
||||
for item in files:
|
||||
item_path = './' + item
|
||||
item_path = path_prefix + './' + item
|
||||
|
||||
handle = open(item_path, 'r')
|
||||
list[item] = base64.b64encode(bytes(handle.read(), 'UTF-8')).decode('ASCII')
|
||||
@ -30,19 +34,20 @@ def encode_files(files):
|
||||
|
||||
return list
|
||||
|
||||
# file manifest (reflects imgen.py)
|
||||
manifest = {
|
||||
"files" : {
|
||||
# common files
|
||||
"system" : encode_files([ "initenv.lua", "startup.lua", "configure.lua", "LICENSE" ]),
|
||||
"common" : encode_recursive("./scada-common"),
|
||||
"graphics" : encode_recursive("./graphics"),
|
||||
"lockbox" : encode_recursive("./lockbox"),
|
||||
"common" : encode_recursive(path_prefix + "./scada-common"),
|
||||
"graphics" : encode_recursive(path_prefix + "./graphics"),
|
||||
"lockbox" : encode_recursive(path_prefix + "./lockbox"),
|
||||
# platform files
|
||||
"reactor-plc" : encode_recursive("./reactor-plc"),
|
||||
"rtu" : encode_recursive("./rtu"),
|
||||
"supervisor" : encode_recursive("./supervisor"),
|
||||
"coordinator" : encode_recursive("./coordinator"),
|
||||
"pocket" : encode_recursive("./pocket"),
|
||||
"reactor-plc" : encode_recursive(path_prefix + "./reactor-plc"),
|
||||
"rtu" : encode_recursive(path_prefix + "./rtu"),
|
||||
"supervisor" : encode_recursive(path_prefix + "./supervisor"),
|
||||
"coordinator" : encode_recursive(path_prefix + "./coordinator"),
|
||||
"pocket" : encode_recursive(path_prefix + "./pocket"),
|
||||
},
|
||||
"depends" : {
|
||||
"reactor-plc" : [ "reactor-plc", "system", "common", "graphics", "lockbox" ],
|
||||
@ -53,6 +58,7 @@ manifest = {
|
||||
}
|
||||
}
|
||||
|
||||
# write the application installation items as Lua tables
|
||||
def write_items(body, items, indent):
|
||||
indent_str = " " * indent
|
||||
for key, value in items.items():
|
||||
@ -66,6 +72,7 @@ def write_items(body, items, indent):
|
||||
return body
|
||||
|
||||
|
||||
|
||||
for app in [ "reactor-plc", "rtu", "supervisor", "coordinator", "pocket" ]:
|
||||
f = open("_" + app + ".lua", "w")
|
||||
body = "local application = {\n"
|
Loading…
Reference in New Issue
Block a user