Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
import datetime
def write_version_to_file(filepath, contents):
with open(filepath, "w", encoding="utf-8") as f:
f.write(contents)
def make_version_string():
now = datetime.datetime.now()
year = now.strftime('%Y')
month = now.strftime('%m')
day = now.strftime('%d')
version_header = \
f"""#ifndef __OPENFAN_MICRO_PD_FW_VERSION_H_INC__
#define __OPENFAN_MICRO_PD_FW_VERSION_H_INC__
#define VERSION_MAJOR "{year}"
#define VERSION_MINOR "{month}"
#define VERSION_PATCH "{day}"
#endif
"""
print(f"New version {year}-{month}-{day}")
return version_header
def make_version():
print("--- Cutting version ---")
version = make_version_string()
write_version_to_file('src/version.h', version)
Import("env")
make_version()
e06d35797This file is pinned to the selected release. Download the original to open it in your design tool.