1
0
mirror of https://github.com/Utyff/Zintercom.git synced 2026-01-12 01:07:43 +03:00
Files
Zintercom/ver.py
2020-12-27 14:40:06 +02:00

30 lines
799 B
Python

from datetime import datetime
from os.path import dirname, join
cwd = dirname(__file__)
now = datetime.now()
dt_string = now.strftime("%d/%m/%Y %H:%M")
print("date and time =", dt_string)
with open(join(cwd, './Source/version.c'), 'w') as f:
chars = ["'{0}'".format(char) for char in dt_string]
f.write("""
#ifndef ZCL_APP_VERSION_H
#define ZCL_APP_VERSION_H
#ifdef __cplusplus
extern "C" {
#endif
"""
)
f.write('#include "version.h"\n')
code = """const uint8 zclApp_DateCode[] = {{ {0}, {1} }};\n""".format(len(chars), ', '.join(chars))
f.write(code)
code = """const char zclApp_DateCodeNT[] = \"{0}\";\n""".format(dt_string)
f.write(code)
f.write("""
#ifdef __cplusplus
}
#endif
#endif /* ZCL_APP_VERSION_H */
""")