mirror of
https://github.com/deunix-educ/PyQuest.git
synced 2026-11-25 08:19:44 +01:00
Add make fetch-nginx: unprivileged nginx binary for the local full-stack test
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,7 @@ VENV := .venv
|
||||
VENV_PY := $(VENV)/bin/python
|
||||
PORT ?= 8000
|
||||
|
||||
.PHONY: help install vendor-pyodide dev validate-levels build dev-sync dev-nginx docs docs-serve deploy check-deploy test-deploy test test-js test-python test-backend test-e2e typecheck icons voice check-voice ci ci-e2e clean
|
||||
.PHONY: help install vendor-pyodide dev validate-levels build dev-sync fetch-nginx dev-nginx docs docs-serve deploy check-deploy test-deploy test test-js test-python test-backend test-e2e typecheck icons voice check-voice ci ci-e2e clean
|
||||
|
||||
help: ## Affiche cette aide
|
||||
@grep -E '^[a-z-]+:.*##' $(MAKEFILE_LIST) | awk -F':.*## ' '{printf " %-16s %s\n", $$1, $$2}'
|
||||
@@ -51,6 +51,9 @@ docs: $(DOCS_VENV)/.installed ## Génère la documentation bilingue dans site/ (
|
||||
docs-serve: $(DOCS_VENV)/.installed ## Documentation en direct sur http://127.0.0.1:8003/
|
||||
$(DOCS_VENV)/bin/mkdocs serve --dev-addr 127.0.0.1:8003
|
||||
|
||||
fetch-nginx: ## Récupère le binaire nginx dans .local/nginx (Debian/Ubuntu, sans droits root) pour make dev-nginx
|
||||
./scripts/fetch_nginx.sh
|
||||
|
||||
dev-nginx: $(VENV)/.installed build ## Pile locale réelle : nginx + Django (éditeur protégé, API) sur http://127.0.0.1:8080/
|
||||
$(VENV_PY) scripts/local_stack.py
|
||||
|
||||
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
# Récupère le binaire nginx de la distribution (Debian/Ubuntu) SANS droits administrateur ni installation :
|
||||
# le paquet est téléchargé puis extrait dans .local/nginx/. Utilisé par « make dev-nginx » (essai local).
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
TARGET="${ROOT}/.local/nginx"
|
||||
BINARY="${TARGET}/root/usr/sbin/nginx"
|
||||
|
||||
if [[ -x "${BINARY}" ]]; then
|
||||
echo "nginx déjà présent : ${BINARY}"
|
||||
exit 0
|
||||
fi
|
||||
command -v apt-get >/dev/null || { echo "apt-get absent : installe nginx avec le gestionnaire de ta distribution, ou indique son binaire avec PYQUEST_NGINX." >&2; exit 1; }
|
||||
command -v dpkg >/dev/null || { echo "dpkg absent : voir PYQUEST_NGINX." >&2; exit 1; }
|
||||
|
||||
WORK="$(mktemp -d)"
|
||||
trap 'rm -rf "${WORK}"' EXIT
|
||||
(cd "${WORK}" && apt-get download nginx)
|
||||
mkdir -p "${TARGET}/root"
|
||||
dpkg -x "${WORK}"/nginx_*.deb "${TARGET}/root"
|
||||
"${BINARY}" -v
|
||||
echo "nginx extrait dans ${TARGET} (aucune installation système)."
|
||||
@@ -57,12 +57,13 @@ http {{
|
||||
|
||||
|
||||
def find_nginx(explicit: str | None) -> str:
|
||||
candidate = explicit or os.environ.get("PYQUEST_NGINX") or shutil.which("nginx")
|
||||
fetched = ROOT / ".local/nginx/root/usr/sbin/nginx" # créé par scripts/fetch_nginx.sh (make fetch-nginx)
|
||||
candidate = explicit or os.environ.get("PYQUEST_NGINX") or shutil.which("nginx") or (str(fetched) if fetched.is_file() else None)
|
||||
if not candidate or not Path(candidate).is_file():
|
||||
sys.exit(
|
||||
"nginx introuvable. Installe-le (sudo apt install nginx) ou récupère seulement le binaire sans droits root :\n"
|
||||
" mkdir -p /tmp/ngx && cd /tmp/ngx && apt-get download nginx && dpkg -x nginx_*.deb root\n"
|
||||
" PYQUEST_NGINX=/tmp/ngx/root/usr/sbin/nginx python3 scripts/local_stack.py"
|
||||
"nginx introuvable. Le plus simple (Debian/Ubuntu, sans droits administrateur ni installation) :\n"
|
||||
" make fetch-nginx && make dev-nginx\n"
|
||||
"Ou installe nginx (sudo apt install nginx), ou indique son binaire : PYQUEST_NGINX=/chemin/nginx make dev-nginx"
|
||||
)
|
||||
return candidate
|
||||
|
||||
|
||||
Reference in New Issue
Block a user