34 lines
757 B
Python
34 lines
757 B
Python
#!/usr/bin/env python3
|
|
from ruamel.yaml import YAML
|
|
from pathlib import Path
|
|
import sys
|
|
|
|
yaml = YAML()
|
|
yaml.preserve_quotes = True
|
|
|
|
path = Path(sys.argv[1])
|
|
|
|
with path.open("r") as f:
|
|
data = yaml.load(f)
|
|
|
|
extra = data["services"]["collabora"]["environment"]["extra_params"]
|
|
|
|
# normalize to string
|
|
extra_str = str(extra)
|
|
|
|
if "--o:hexify_embedded_urls=true" in extra_str:
|
|
print("[patch-weboffice-collabora-yaml] already patched")
|
|
sys.exit(0)
|
|
|
|
lines = extra_str.splitlines()
|
|
|
|
lines[-1] = lines[-1] += " \\"
|
|
|
|
lines.append("--o:hexify_embedded_urls=true")
|
|
|
|
data["services"]["collabora"]["environment"]["extra_params"] = "\n".join(lines)
|
|
|
|
with path.open("w") as f:
|
|
yaml.dump(data, f)
|
|
|
|
print("[patch-weboffice-collabora-yaml] patched successfully") |