22 lines
650 B
Python
22 lines
650 B
Python
import os
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
source = os.environ.get("COOKBOOK_SOURCE", ".")
|
|
path = Path(source) / "src/qmltyperegistrar/CMakeLists.txt"
|
|
|
|
if not path.exists():
|
|
print(f"File not found: {path}", file=sys.stderr)
|
|
sys.exit(1)
|
|
|
|
text = path.read_text()
|
|
old = 'qt_internal_add_resource(QmlTypeRegistrarPrivate "jsRootMetaTypes"'
|
|
new = 'qt_internal_add_resource(QmlTypeRegistrarPrivate "jsRootMetaTypes"\n OPTIONS\n --no-compress'
|
|
|
|
if old in text:
|
|
text = text.replace(old, new)
|
|
path.write_text(text)
|
|
print("Patched qmltyperegistrar/CMakeLists.txt")
|
|
else:
|
|
print("Pattern not found, may already be patched")
|