#!/usr/bin/env python3 """Build the standalone WordPress plugin, without tests or customer data.""" from pathlib import Path import zipfile from sync_shared import verify_shared root = Path(__file__).resolve().parents[1] verify_shared(root) target = root / 'dist/hg-registrations.zip' target.parent.mkdir(exist_ok=True) with zipfile.ZipFile(target, 'w', zipfile.ZIP_DEFLATED) as archive: files = [root / 'hg-registrations.php', root / 'readme.txt', root / 'LICENSE'] for folder in ['includes', 'assets']: files.extend(sorted((root / folder).rglob('*'))) for path in files: if path.is_file(): archive.write(path, Path('hg-registrations') / path.relative_to(root)) print(target)