forked from diyruz/AirSense
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ver.py
30 lines (27 loc) · 799 Bytes
/
ver.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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 */
""")