MC/website/scripts/install-bank-credit-support.py

16 lines
735 B
Python

"""Install the existing-flow loan ticket adapter from a CI-approved release."""
from pathlib import Path
import os
import subprocess
import sys
source = Path(__file__).resolve().parents[1] / 'integrations/osticket/bank-credit-ticket.php'
target = Path('/home/dunerealms/apps/integrations/osticket/bank-credit-ticket.php')
subprocess.run(['php', '-l', str(source)], check=True)
if '--apply' not in sys.argv:
print('Plan: install one private CLI ticket adapter; no changes applied')
sys.exit(0)
temporary = target.with_name(target.name + '.migration-new')
temporary.write_bytes(source.read_bytes())
temporary.chmod(0o644)
os.replace(temporary, target)
print('Installed private bank-credit ticket adapter; native core unchanged')