forked from distok/cutthecord
customversion: Make customversion display more details
This commit is contained in:
parent
9d3f6b8215
commit
5d02aba5d4
3 changed files with 33 additions and 1 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
patches/customversion/*-custom.patch
|
|
@ -14,7 +14,7 @@ diff -crB -x dist -x build com.discord-832-base/smali/com/discord/widgets/settin
|
|||
|
||||
invoke-virtual {v1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||||
|
||||
! const-string v0, " - 8.3.2 (832), with Cutthecord patches applied"
|
||||
! const-string v0, " - 8.3.2 (832), with Cutthecord patches"
|
||||
|
||||
invoke-virtual {v1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||||
|
31
patches/customversion/addpatch.py
Normal file
31
patches/customversion/addpatch.py
Normal file
|
@ -0,0 +1,31 @@
|
|||
#!/bin/env python3
|
||||
import sys
|
||||
import os
|
||||
import datetime
|
||||
import socket
|
||||
|
||||
fname = sys.argv[1]
|
||||
|
||||
# Read in the file
|
||||
with open(fname, 'r') as file:
|
||||
filedata = file.read()
|
||||
|
||||
customtext = ""
|
||||
|
||||
for arg in range(2, len(sys.argv)):
|
||||
customtext += " {},".format(sys.argv[arg])
|
||||
customtext = customtext.strip(",")
|
||||
|
||||
timestamp = str(datetime.datetime.utcnow()) + " UTC"
|
||||
|
||||
customtext += ", built on {}@{} at {}".format(os.getlogin(),
|
||||
socket.gethostname(),
|
||||
timestamp)
|
||||
|
||||
# Replace the target string
|
||||
filedata = filedata.replace('with Cutthecord patches"',
|
||||
'with Cutthecord patches{}"'.format(customtext))
|
||||
|
||||
# Write the file out again
|
||||
with open(fname.replace(".patch", "-custom.patch"), 'w') as file:
|
||||
file.write(filedata)
|
Loading…
Reference in a new issue