Dynamic build_flags in platformio.ini / UNIX_TIME

Have this bash file to set up build flags:

Can we replace this with python script?
I tried your code, with this directiive in my platformio.ini
extra_scripts = pre:my_build_flags.py
but it does not change build flags.

The reason is to build project from IDE, deal with errors there, having python scripts for every set of build flags.