added patcher
This commit is contained in:
parent
5f049470f4
commit
59730d52ba
1 changed files with 19 additions and 0 deletions
19
patch.py
Executable file
19
patch.py
Executable file
|
@ -0,0 +1,19 @@
|
||||||
|
#!/bin/python3.6
|
||||||
|
import sys
|
||||||
|
|
||||||
|
patch=open(sys.argv[1], "r").readlines()
|
||||||
|
orig=open(sys.argv[2],"r")
|
||||||
|
origlines = orig.readlines()
|
||||||
|
|
||||||
|
for idx,oline in enumerate(origlines):
|
||||||
|
subst = oline.split('=')
|
||||||
|
for idx1,pline in enumerate(patch):
|
||||||
|
if subst[0] in pline:
|
||||||
|
origlines[idx] = pline
|
||||||
|
patch.pop(idx1)
|
||||||
|
origlines += patch
|
||||||
|
orig.close
|
||||||
|
|
||||||
|
new=open(sys.argv[2],"w")
|
||||||
|
new.writelines(origlines)
|
||||||
|
new.close
|
Loading…
Reference in a new issue