WLED/pio/gzip-firmware.py
Jason2866 a839ec4832
Add gzip support for full OTA possibilitys for 1M build (#1266)
* delete history

* add firmware

Signed-off-by: Jason2866 <obermeier.johann@googlemail.com>

* Delete platformio_override.ini

* Update .gitignore

* Delete WLED_tasmota_1M.bin

* Delete WLED_tasmota_1M.bin.gz

* Update platformio.ini

* Core 2.7.4.5

* new override

* actual firmware

* Update user_config_override_sample.h

* Delete platformio_override.ini

* Delete WLED_tasmota_1M.bin

* Delete WLED_tasmota_1M.bin.gz

* core 2.7.4.7
2020-11-17 21:49:39 +01:00

24 lines
767 B
Python

Import('env')
import os
import shutil
import gzip
OUTPUT_DIR = "build_output{}".format(os.path.sep)
def bin_gzip(source, target, env):
variant = str(target[0]).split(os.path.sep)[2]
# create string with location and file names based on variant
bin_file = "{}firmware{}{}.bin".format(OUTPUT_DIR, os.path.sep, variant)
gzip_file = "{}firmware{}{}.bin.gz".format(OUTPUT_DIR, os.path.sep, variant)
# check if new target files exist and remove if necessary
if os.path.isfile(gzip_file): os.remove(gzip_file)
# write gzip firmware file
with open(bin_file,"rb") as fp:
with gzip.open(gzip_file, "wb", compresslevel = 9) as f:
shutil.copyfileobj(fp, f)
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", [bin_gzip])