fix(bundle): copy all top-level core python packages (routers/ etc.)

core#834 extracted routes into a new top-level routers/ package; the
bundle script only copied lib/, so the packaged backend would die with
ModuleNotFoundError: No module named 'routers'. Copy every top-level
package (dir with __init__.py) except plugins/ (bundled selectively
below) and tests/ (never ships), so the ongoing R3 extraction series
can't keep breaking packaged builds.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
OmikronApex
2026-07-10 16:47:32 +02:00
co-authored by Claude Fable 5
parent add4facb85
commit 09617aa417
+13 -1
View File
@@ -53,8 +53,20 @@ mkdir -p "$BUNDLE_DIR/static" "$BUNDLE_DIR/plugins"
# packaged backend with ModuleNotFoundError on startup.
cp "$SLOPSMITH_DIR"/*.py "$BUNDLE_DIR/"
cp "$SLOPSMITH_DIR/VERSION" "$BUNDLE_DIR/"
# Copy every top-level python package (dir with __init__.py), not a hardcoded
# list — core's R3 refactor keeps adding packages (routers/ in core#834, lib
# extractions in #830/#831) and each miss ships a backend that dies on import.
# plugins/ is bundled selectively further down; tests/ must never ship.
for pkg in "$SLOPSMITH_DIR"/*/__init__.py; do
[ -f "$pkg" ] || continue
pkg_dir="$(dirname "$pkg")"
case "$(basename "$pkg_dir")" in
plugins|tests) continue ;;
esac
cp -r "$pkg_dir" "$BUNDLE_DIR/"
done
cp -r "$SLOPSMITH_DIR/lib" "$BUNDLE_DIR/"
rm -rf "$BUNDLE_DIR/lib/__pycache__"
find "$BUNDLE_DIR" -type d -name '__pycache__' -prune -exec rm -rf {} +
# Bundled content (progression paths, quests, shop definitions)
[ -d "$SLOPSMITH_DIR/data" ] && cp -r "$SLOPSMITH_DIR/data" "$BUNDLE_DIR/"