14 lines
444 B
Python
14 lines
444 B
Python
import subprocess
|
|
from datetime import datetime
|
|
|
|
|
|
def gen_build_info():
|
|
hash_str = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).decode('utf-8').strip()
|
|
with open('build_info.py', 'w', encoding='utf-8') as f:
|
|
f.write(f"# Auto-generated build info\n")
|
|
f.write(f"BUILD_TIME = '{datetime.now().isoformat(sep=' ', timespec='seconds')}'\n")
|
|
f.write(f"GIT_HASH = '{hash_str}'\n")
|
|
|
|
|
|
gen_build_info()
|