222ad10ded
- package.py: addon manifest (v0.1.0) - server/__init__.py: BaseServerAddon definition - server/ayon_matrix_publish/plugins/publish/integrate_matrix.py: Pyblish plugin that uploads published representations to Matrix rooms during the Integration stage. Supports: - Upload to Matrix content repository (mxc:// URI) - Formatted messages with preview images - Auto room creation per asset - Configurable via Studio Settings or env vars - create_package.py: builds distributable .zip package
52 lines
1.6 KiB
Python
52 lines
1.6 KiB
Python
#!/usr/bin/env python3
|
|
"""Create an AYON addon .zip package for distribution."""
|
|
|
|
import os
|
|
import sys
|
|
import zipfile
|
|
from pathlib import Path
|
|
|
|
|
|
def create_package():
|
|
root = Path(__file__).parent
|
|
|
|
# Read version
|
|
version_file = root / "server" / "ayon_matrix_publish" / "version.py"
|
|
version = "0.1.0"
|
|
if version_file.exists():
|
|
exec(version_file.read_text(), {}, {})
|
|
version = locals().get("__version__", version)
|
|
|
|
package_name = f"matrix_publish-{version}.zip"
|
|
package_path = root / package_name
|
|
|
|
print(f"Creating {package_name}...")
|
|
|
|
with zipfile.ZipFile(package_path, "w", zipfile.ZIP_DEFLATED) as zf:
|
|
# Add package.py
|
|
zf.write(root / "package.py", "package.py")
|
|
|
|
# Add server files
|
|
server_dir = root / "server"
|
|
for file_path in server_dir.rglob("*"):
|
|
if file_path.is_file() and "__pycache__" not in str(file_path):
|
|
arcname = str(file_path.relative_to(root))
|
|
zf.write(file_path, arcname)
|
|
print(f" + {arcname}")
|
|
|
|
# Add client files
|
|
client_dir = root / "client"
|
|
if client_dir.exists():
|
|
for file_path in client_dir.rglob("*"):
|
|
if file_path.is_file() and "__pycache__" not in str(file_path):
|
|
arcname = str(file_path.relative_to(root))
|
|
zf.write(file_path, arcname)
|
|
print(f" + {arcname}")
|
|
|
|
print(f"\nPackage created: {package_path}")
|
|
print(f"Size: {package_path.stat().st_size / 1024:.1f} KB")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
create_package()
|