Fix install: copy tui/ package and install Python deps

- Install script now copies tui/ directory to install location
- Installs textual and textual-serve via pip after file copy
- __main__.py uses GNIZA_DIR env var for correct path resolution

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
shuki
2026-03-06 00:58:58 +02:00
parent 63e88d11df
commit 01cbe70c5d
2 changed files with 23 additions and 4 deletions

View File

@@ -132,6 +132,10 @@ cp -r "$SOURCE_DIR/bin" "$INSTALL_DIR/"
cp -r "$SOURCE_DIR/lib" "$INSTALL_DIR/" cp -r "$SOURCE_DIR/lib" "$INSTALL_DIR/"
cp -r "$SOURCE_DIR/etc" "$INSTALL_DIR/" cp -r "$SOURCE_DIR/etc" "$INSTALL_DIR/"
if [[ -d "$SOURCE_DIR/tui" ]]; then
cp -r "$SOURCE_DIR/tui" "$INSTALL_DIR/"
fi
if [[ -d "$SOURCE_DIR/scripts" ]]; then if [[ -d "$SOURCE_DIR/scripts" ]]; then
cp -r "$SOURCE_DIR/scripts" "$INSTALL_DIR/" cp -r "$SOURCE_DIR/scripts" "$INSTALL_DIR/"
fi fi
@@ -143,6 +147,21 @@ fi
# Make entrypoint executable # Make entrypoint executable
chmod +x "$INSTALL_DIR/bin/gniza" chmod +x "$INSTALL_DIR/bin/gniza"
# ── Install Python TUI dependencies ─────────────────────────
if command -v python3 &>/dev/null; then
info "Installing Python TUI dependencies (textual, textual-serve)..."
if python3 -m pip install --break-system-packages textual textual-serve 2>/dev/null; then
info "Python TUI dependencies installed."
elif python3 -m pip install textual textual-serve 2>/dev/null; then
info "Python TUI dependencies installed."
else
warn "Could not install Python TUI dependencies. TUI/web mode may not work."
warn "Install manually: pip3 install textual textual-serve"
fi
else
warn "python3 not found. TUI mode will not be available."
fi
# ── Create symlink ─────────────────────────────────────────── # ── Create symlink ───────────────────────────────────────────
info "Creating symlink: $BIN_LINK -> $INSTALL_DIR/bin/gniza" info "Creating symlink: $BIN_LINK -> $INSTALL_DIR/bin/gniza"
mkdir -p "$(dirname "$BIN_LINK")" mkdir -p "$(dirname "$BIN_LINK")"

View File

@@ -4,8 +4,8 @@ from pathlib import Path
from tui.app import GnizaApp from tui.app import GnizaApp
# Resolve project root (parent of tui/) # Use GNIZA_DIR from env (set by bin/gniza), fall back to parent of tui/
_PROJECT_ROOT = str(Path(__file__).resolve().parent.parent) _ROOT = os.environ.get("GNIZA_DIR", str(Path(__file__).resolve().parent.parent))
def main(): def main():
@@ -15,8 +15,8 @@ def main():
for i, arg in enumerate(sys.argv): for i, arg in enumerate(sys.argv):
if arg == "--port" and i + 1 < len(sys.argv): if arg == "--port" and i + 1 < len(sys.argv):
port = int(sys.argv[i + 1]) port = int(sys.argv[i + 1])
os.environ["PYTHONPATH"] = f"{_PROJECT_ROOT}:{os.environ.get('PYTHONPATH', '')}" os.environ["PYTHONPATH"] = f"{_ROOT}:{os.environ.get('PYTHONPATH', '')}"
os.environ["GNIZA_DIR"] = _PROJECT_ROOT os.environ["GNIZA_DIR"] = _ROOT
server = Server("python3 -m tui", host="0.0.0.0", port=port, title="gniza") server = Server("python3 -m tui", host="0.0.0.0", port=port, title="gniza")
server.serve() server.serve()
else: else: