mirror of https://github.com/lumapu/ahoy.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
925 B
32 lines
925 B
3 years ago
|
import os
|
||
|
from datetime import date
|
||
|
|
||
3 years ago
|
def readVersion(path, infile):
|
||
|
f = open(path + infile, "r")
|
||
3 years ago
|
lines = f.readlines()
|
||
|
f.close()
|
||
|
|
||
|
today = date.today()
|
||
|
search = ["_MAJOR", "_MINOR", "_PATCH"]
|
||
|
version = today.strftime("%y%m%d") + "_ahoy_"
|
||
|
for line in lines:
|
||
|
if(line.find("VERSION_") != -1):
|
||
|
for s in search:
|
||
|
p = line.find(s)
|
||
|
if(p != -1):
|
||
|
version += line[p+13:].rstrip() + "."
|
||
2 years ago
|
|
||
|
os.mkdir(path + ".pio/build/out/")
|
||
|
|
||
|
versionout = version[:-1] + "_esp8266_node_mcu_v2.bin"
|
||
2 years ago
|
src = path + ".pio/build/node_mcu_v2/firmware.bin"
|
||
2 years ago
|
dst = path + ".pio/build/out/" + versionout
|
||
2 years ago
|
os.rename(src, dst)
|
||
|
|
||
2 years ago
|
versionout = version[:-1] + "_esp8266_d1_mini.bin"
|
||
3 years ago
|
src = path + ".pio/build/d1_mini/firmware.bin"
|
||
2 years ago
|
dst = path + ".pio/build/out/" + versionout
|
||
3 years ago
|
os.rename(src, dst)
|
||
|
|
||
3 years ago
|
readVersion("../", "defines.h")
|