13 lines
599 B
Python
13 lines
599 B
Python
#!/usr/bin/env python3
|
|||
|
|
"""Build a WordPress-installable ZIP from this checkout."""
|
||
|
|
from pathlib import Path
|
||
|
|
import zipfile
|
||
|
|
root=Path(__file__).resolve().parents[1]
|
||
|
|
destination=root/'dist/hg-contactform.zip'
|
||
|
|
destination.parent.mkdir(exist_ok=True)
|
||
|
|
files=[root/'hg-contactform.php',root/'readme.txt',root/'LICENSE']
|
||
|
|
for directory in ['assets','includes']:files.extend(sorted((root/directory).rglob('*')))
|
||
|
|
with zipfile.ZipFile(destination,'w',zipfile.ZIP_DEFLATED) as archive:
|
||
|
|
for path in files:
|
||
|
|
if path.is_file():archive.write(path,Path('hg-contactform')/path.relative_to(root))
|
||
|
|
print(destination)
|