Files
MINGW-packages/mingw-w64-perl-Math-Int64/patchmakefile.py
Naveen M K e948594e25 perl-Math-Int64: new package
Signed-off-by: Naveen M K <naveen@syrusdark.website>
2021-04-17 17:19:43 +05:30

20 lines
499 B
Python

import re
import os
from pathlib import Path
prefix = "\\".join(os.getenv('MINGW_PREFIX','C:\\msys64\\mingw64').split('/')[:-1]) + '\\'
prefix = prefix.replace('\\','\\\\') # needed for regex
pkgdir = os.getenv("pkgdir").replace('/','\\')
reg = re.compile(f'(?P<key>INSTALL(\S*)) = {prefix}(?P<value>\S*)')
def do(a: re.Match):
return f"{a.group('key')} = {a.group('value')}"
with open('Makefile') as f:
c = f.read()
c = reg.sub(do,c)
with open('Makefile','w') as f:
f.write(c)