from pathlib import Path import json, subprocess ROOT = Path(__file__).resolve().parent.parent PRIVATE = ROOT / 'storage/app/private/investmoz-v2/portal-audit' plan = json.loads((PRIVATE / 'country-c110-source-latest.json').read_text()) source = Path(plan['source']) original = (ROOT / 'tools/portal-country-production-stage.py').read_text(encoding='utf-8') original = original.replace("ROOT = Path(__file__).resolve().parent.parent", "ROOT = Path(__file__).resolve().parent.parent\nLIVE = Path('C:/laragon/www/portal-investidor')") original = original.replace("OUT = ROOT / 'outputs/investmoz-country02-candidate-20261011'", "OUT = LIVE / 'outputs/investmoz-country02-c110-20261011'") original = original.replace("PRIVATE = ROOT / 'storage/app/private/investmoz-v2/portal-audit'", "PRIVATE = LIVE / 'storage/app/private/investmoz-v2/portal-audit'") original = original.replace("ROOT / 'public/build'", "LIVE / 'public/build'") original = original.replace("'vite.config.ts']:", "'vite.config.ts', 'qa-autoload.php']:") original = original.replace("$loader = require __DIR__.'/vendor/autoload.php';", "$loader = require __DIR__.'/qa-autoload.php';") original = original.replace("country-production-stage-latest.json", "country-c110-production-stage-latest.json") builder = source / 'tools/portal-country-c110-isolated-build.py' builder.write_text(original, encoding='utf-8') subprocess.run(['C:/Users/macbook/.cache/codex-runtimes/codex-primary-runtime/dependencies/python/python.exe','-X','utf8',str(builder)],check=True)