diff --git a/code/extra_scripts.py b/code/extra_scripts.py index 9d0bc80d..790b1ceb 100644 --- a/code/extra_scripts.py +++ b/code/extra_scripts.py @@ -63,7 +63,7 @@ def build_webui(source, target, env): config = util.load_project_config() kv = dict(config.items("env:" + env.get('PIOENV'))) if 'modules' in kv: - os.environ['MODULES'] = kv["modules"] + os.environ['WEBUI_MODULES'] = kv["modules"] call(["gulp"]) # ------------------------------------------------------------------------------ diff --git a/code/gulpfile.js b/code/gulpfile.js index ad270922..8ce50eea 100644 --- a/code/gulpfile.js +++ b/code/gulpfile.js @@ -113,8 +113,8 @@ gulp.task('buildfs_inline', function() { light: false, rfbridge: false }; - var modules = 'MODULES' in process.env ? process.env.MODULES : false; - if (false === modules) { + var modules = 'WEBUI_MODULES' in process.env ? process.env.WEBUI_MODULES : false; + if (false === modules || "all" === modules) { for (var i in remover_config) { remover_config[i] = true; } diff --git a/code/ota.py b/code/ota.py index 16b86f82..8f9fc219 100755 --- a/code/ota.py +++ b/code/ota.py @@ -121,7 +121,7 @@ def get_empty_board(): """ Returns the empty structure of a board to flash """ - board = {'board': '', 'ip': '', 'size': 0, 'auth': '', 'flags': ''} + board = {'board': '', 'ip': '', 'size': 0, 'auth': '', 'flags': '', 'modules': ''} return board def get_board_by_index(index): @@ -230,8 +230,8 @@ def store(device, env): def run(device, env): print("Building and flashing image over-the-air...") - command = "export ESPURNA_IP=\"%s\"; export ESPURNA_BOARD=\"%s\"; export ESPURNA_AUTH=\"%s\"; export ESPURNA_FLAGS=\"%s\"; platformio run --silent --environment %s -t upload" - command = command % (device['ip'], device['board'], device['auth'], device['flags'], env) + command = "ESPURNA_IP=\"%s\" ESPURNA_BOARD=\"%s\" ESPURNA_AUTH=\"%s\" ESPURNA_FLAGS=\"%s\" WEBUI_MODULES=\"%s\" platformio run --environment %s -t upload" + command = command % (device['ip'], device['board'], device['auth'], device['flags'], device['modules'], env) subprocess.check_call(command, shell=True) store(device, env) @@ -245,6 +245,7 @@ if __name__ == '__main__': parser.add_argument("-f", "--flash", help="flash device", default=0, action='count') parser.add_argument("-o", "--flags", help="extra flags", default='') parser.add_argument("-p", "--password", help="auth password", default='') + parser.add_argument("-m", "--modules", help="webui modules", default='') parser.add_argument("-s", "--sort", help="sort devices list by field", default='hostname') parser.add_argument("-y", "--yes", help="do not ask for confirmation", default=0, action='count') parser.add_argument("hostnames", nargs='*', help="Hostnames to update") @@ -288,6 +289,7 @@ if __name__ == '__main__': if board: board['auth'] = args.password board['flags'] = args.flags + board['modules'] = args.modules queue.append(board) # If no boards ask the user @@ -296,6 +298,7 @@ if __name__ == '__main__': if board: board['auth'] = args.password or input("Authorization key of the device to flash: ") board['flags'] = args.flags or input("Extra flags for the build: ") + board['modules'] = args.modules or input("WebUI modules to build: ") queue.append(board) # If still no boards quit @@ -313,12 +316,13 @@ if __name__ == '__main__': # Summary print() - print("HOST = %s" % boardname(board)) - print("IP = %s" % board['ip']) - print("BOARD = %s" % board['board']) - print("AUTH = %s" % board['auth']) - print("FLAGS = %s" % board['flags']) - print("ENV = %s" % env) + print("HOST = %s" % boardname(board)) + print("IP = %s" % board['ip']) + print("BOARD = %s" % board['board']) + print("AUTH = %s" % board['auth']) + print("FLAGS = %s" % board['flags']) + print("MODULES = %s" % board['modules']) + print("ENV = %s" % env) response = True if args.yes == 0: diff --git a/code/package-lock.json b/code/package-lock.json index 286f8bc3..40709120 100644 --- a/code/package-lock.json +++ b/code/package-lock.json @@ -1625,7 +1625,7 @@ }, "gulp-csslint": { "version": "https://registry.npmjs.org/gulp-csslint/-/gulp-csslint-1.0.1.tgz", - "integrity": "sha1-ESqQj3rvmO/Ce3vQCAHxOne+y5M=", + "integrity": "sha512-Rec56+RpCGg7feK3d/S45oqgxyLV3end0ed+UjWFv6YziQae2Bp4DNSDobwEvJdfCAsOhOSExEEB+jcfMx430w==", "dev": true, "requires": { "csslint": "https://registry.npmjs.org/csslint/-/csslint-1.0.5.tgz", @@ -1648,7 +1648,7 @@ }, "plugin-error": { "version": "https://registry.npmjs.org/plugin-error/-/plugin-error-1.0.1.tgz", - "integrity": "sha1-dwFr2JGdCsN3/c3QMiMolTyleBw=", + "integrity": "sha512-L1zP0dk7vGweZME2i+EeakvUNqSrdiI3F91TwEoYiGrAfUXmVv6fJIq4g82PAXxNsWOp0J7ZqQy/3Szz0ajTxA==", "dev": true, "requires": { "ansi-colors": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-1.1.0.tgz", @@ -1704,8 +1704,9 @@ } }, "gulp-htmllint": { - "version": "https://registry.npmjs.org/gulp-htmllint/-/gulp-htmllint-0.0.14.tgz", - "integrity": "sha1-fobrpgVmjfsVstLVAZX+VqdVhaI=", + "version": "0.0.14", + "resolved": "https://registry.npmjs.org/gulp-htmllint/-/gulp-htmllint-0.0.14.tgz", + "integrity": "sha512-D5FfR2G4SUwxPd/ypE5glZSXXddl3bnGz9JlY3gS5e8AXSvYJco+baIWtpT8fq5aqyr5IELf2I+VgCe6b+yq1A==", "dev": true, "requires": { "gulp-util": "https://registry.npmjs.org/gulp-util/-/gulp-util-3.0.8.tgz",