F.E.I.S/utils/save_meson_wrap.py
2022-04-11 01:25:24 +02:00

25 lines
765 B
Python

"""implement the missing --save option of meson subprojects packagefiles
for wrap-git packages"""
from argparse import ArgumentParser
from path import Path
parser = ArgumentParser()
parser.add_argument("wrap", type=Path)
args = parser.parse_args()
subprojects = Path("subprojects")
if not subprojects.exists():
print(f"{subprojects} folder doesn't exist, are you in the right directory ?")
subproject = subprojects / args.wrap
patch = subprojects / "packagefiles" / args.wrap
if not patch.exists():
print(f"subproject folder doesn't exist ({subproject}), is the name correct ?")
for absolute in subproject.walkfiles("*meson*"):
relative = absolute.relpath(subproject)
(patch / relative).parent.makedirs_p()
absolute.copy(patch / relative)