This repository has been archived on 2021-08-24. You can view files and clone it, but cannot push or open issues or pull requests.
cutthecord/patches/branding/addpatch.py

28 lines
566 B
Python

#!/bin/env python3
import sys
import time
fname = sys.argv[1]
# Read in the file
with open(fname, 'r') as file:
filedata = file.read()
timestamp = str(time.time()).split(".")[0]
name = "CutTheCord"
branch = "base"
if "customtheme" in sys.argv:
branch = "themed"
name += " Themed"
# Replace the target string
filedata = filedata.replace("CTCBRANCH", branch)\
.replace("CTCTIMESTAMP", timestamp)\
.replace("CTCNAME", name)
# Write the file out again
with open(fname.replace(".patch", "-custom.patch"), 'w') as file:
file.write(filedata)