mirror of
https://github.com/denizsafak/abogen.git
synced 2026-07-18 13:40:27 +02:00
feat: Additive merge of webui branch with PyQt GUI support
- Add abogen/pyqt/ package with full PyQt6 desktop GUI - Restore PyQt GUI files (gui.py, book_handler.py, queue_manager_gui.py, voice_formula_gui.py, conversion.py) - Add new shared modules from webui: book_parser.py, subtitle_utils.py, spacy_utils.py - Add Linux libraries (libxcb-cursor) for Qt platform plugin support - Add new epub parsing tests from webui branch - Update pyproject.toml with dual entry points: - abogen: PyQt6 desktop GUI - abogen-web: Flask Web UI - Add PyQt6 to dependencies - Re-export PyQt classes from root modules for backwards compatibility - Merge CHANGELOG.md entries (1.2.0-1.2.5 from webui) - Update README.md with dual interface documentation Implements #26 - shared core with separate UI folders
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Build PyPI package (wheel and sdist) to `dist` folder for abogen."""
|
||||
|
||||
import subprocess
|
||||
import os
|
||||
import shutil
|
||||
import tempfile
|
||||
|
||||
|
||||
def main():
|
||||
script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
output_dir = os.path.join(script_dir, "dist")
|
||||
|
||||
print("🔧 abogen PyPI Package Builder")
|
||||
print("=" * 40)
|
||||
print(f"📁 Script directory: {script_dir}")
|
||||
print(f"📦 Output directory: {output_dir}")
|
||||
|
||||
# Try to print package version if present
|
||||
version = None
|
||||
version_file = os.path.join(script_dir, "abogen", "VERSION")
|
||||
if os.path.isfile(version_file):
|
||||
try:
|
||||
with open(version_file, "r", encoding="utf-8") as vf:
|
||||
version = vf.read().strip()
|
||||
except Exception:
|
||||
version = None
|
||||
if version:
|
||||
print(f"🔖 Package version: {version}")
|
||||
|
||||
# Check if build module is installed, install if not
|
||||
# Temporarily remove script_dir from sys.path to avoid importing local build.py
|
||||
import sys
|
||||
original_path = sys.path[:]
|
||||
try:
|
||||
sys.path = [p for p in sys.path if os.path.abspath(p) != script_dir]
|
||||
import build
|
||||
except ImportError:
|
||||
print("📦 Installing build module...")
|
||||
subprocess.run([sys.executable, "-m", "pip", "install", "build"], check=True)
|
||||
finally:
|
||||
sys.path = original_path
|
||||
|
||||
# Create output directory
|
||||
print(f"📂 Preparing output directory: {output_dir}")
|
||||
if os.path.exists(output_dir):
|
||||
shutil.rmtree(output_dir)
|
||||
os.makedirs(output_dir, exist_ok=True)
|
||||
|
||||
print("🏗️ Building PyPI package...")
|
||||
print(" Using temporary directory to avoid module conflicts...")
|
||||
|
||||
# Run from temp directory to avoid local build.py shadowing the build module
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
print(f" Temp directory: {tmpdir}")
|
||||
print(" Running: python -m build -o <output_dir> <source_dir>")
|
||||
|
||||
result = subprocess.run(
|
||||
[sys.executable, "-m", "build", "-o", output_dir, script_dir],
|
||||
check=False,
|
||||
cwd=tmpdir,
|
||||
)
|
||||
|
||||
print("\n" + "=" * 40)
|
||||
if result.returncode == 0:
|
||||
print("✅ Build successful!")
|
||||
print(f"📦 Files created in {output_dir}:")
|
||||
|
||||
files = os.listdir(output_dir)
|
||||
if files:
|
||||
for f in files:
|
||||
file_path = os.path.join(output_dir, f)
|
||||
size = os.path.getsize(file_path)
|
||||
print(f" 📄 {f} ({size:,} bytes)")
|
||||
else:
|
||||
print(" (No files found)")
|
||||
|
||||
print("\n🚀 Ready for upload with:\n")
|
||||
print(" - To test on Test PyPI:")
|
||||
print(f" python -m twine upload --repository testpypi {output_dir}/*")
|
||||
print("\n - To upload to PyPI (when ready):")
|
||||
print(f" python -m twine upload {output_dir}/*")
|
||||
else:
|
||||
print("❌ Build failed!")
|
||||
print(f" Exit code: {result.returncode}")
|
||||
sys.exit(result.returncode)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user