15 lines
856 B
Python
15 lines
856 B
Python
from pathlib import Path
|
|
import hashlib,json,shutil
|
|
root=Path('C:/wechat_rpa')
|
|
source=root/'app_version.py'
|
|
backup=root/'backups/protocol-file-identity-20260917/app_version.py'
|
|
assert not backup.exists(),backup
|
|
text=source.read_text(encoding='utf-8')
|
|
assert text.count('APP_VERSION = "1.4.16"')==1
|
|
backup.parent.mkdir(parents=True,exist_ok=True)
|
|
shutil.copy2(source,backup)
|
|
source.write_text(text.replace('APP_VERSION = "1.4.16"','APP_VERSION = "1.4.17"'),encoding='utf-8',newline='\n')
|
|
report={'version':'1.4.17','previous':'1.4.16','source':str(source),'backup':str(backup),'sha256':hashlib.sha256(source.read_bytes()).hexdigest(),'buildStarted':False}
|
|
Path('C:/kefu/deploy/protocol-file-identity-20260917/release-preparation.json').write_text(json.dumps(report,ensure_ascii=False,indent=2),encoding='utf-8')
|
|
print(json.dumps(report,ensure_ascii=False))
|