Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ XHANDLER_E2E=true uv run pytest tests/test_e2e.py # crea, firma y envía una fa
conformidad (`testdata/conformance/`). No los edites a mano. La versión del paquete es la del
núcleo, y una versión solo se publica con el núcleo de la versión igual de xhandler-rust:
`make verify-core` lo comprueba.
Estos comandos descargan el `core.sh` de xhandler-rust (`xhandler-wasm/core.sh`) del tag del
núcleo; `CORE_SH=<ruta>` usa una copia local, p. ej. al cambiarlo allá.
- En Python está lo que necesita IO: el cliente HTTP (httpx), los reintentos y el caché de tokens
(`src/xhandler/xsender/`).
- Los nombres (`FileSender`, `SunatClient`, `SigningKey`...) se mantienen iguales en Go, Python y
Expand Down
17 changes: 14 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ DIST := $(if $(CORE),.dist,$(RUST_REPO)/dist)

SYNCED := src/xhandler/_core/xhandler.wasm src/xhandler/_core/VERSION src/xhandler/xbuilder/models.py testdata/conformance

# core.sh syncs and verifies a released core. It lives in xhandler-rust, next to the release
# format it reads, and is downloaded from the tag of the core at hand (from main for a core
# released before it was there, or not released). CORE_SH=<path> runs a local copy instead, e.g.
# while changing it in xhandler-rust.
CORE_SH ?=
CORE_SH_URL := https://raw.githubusercontent.com/project-openubl/xhandler-rust
# $(call core_sh,<core version>,<core.sh arguments>)
core_sh = $(if $(CORE_SH),bash $(CORE_SH) $(2),script=$$(mktemp) && trap 'rm -f "$$script"' EXIT && \
{ curl -fsSL -o "$$script" $(CORE_SH_URL)/v$(1)/xhandler-wasm/core.sh 2>/dev/null || \
curl -fsSL -o "$$script" $(CORE_SH_URL)/main/xhandler-wasm/core.sh; } && bash "$$script" $(2))

.PHONY: sync dist verify-core verify-release test lint

sync: dist
Expand All @@ -27,14 +38,14 @@ dist:
ifeq ($(CORE),)
$(MAKE) -C $(RUST_REPO)/xhandler-wasm dist
else
./hack/core.sh download $(CORE) $(DIST)
$(call core_sh,$(CORE:v%=%),download $(CORE) $(DIST))
endif

verify-core:
./hack/core.sh verify src/xhandler/_core/xhandler.wasm src/xhandler/_core/VERSION
$(call core_sh,$$(tr -d '\r\n' <src/xhandler/_core/VERSION),verify src/xhandler/_core/xhandler.wasm src/xhandler/_core/VERSION)

verify-release:
./hack/core.sh verify-release $(TAG) src/xhandler/_core/xhandler.wasm src/xhandler/_core/VERSION
$(call core_sh,$(TAG:v%=%),verify-release $(TAG) src/xhandler/_core/xhandler.wasm src/xhandler/_core/VERSION)
$(MAKE) --no-print-directory sync CORE=$(TAG:v%=%)
@if [ -n "$$(git status --porcelain -- $(SYNCED))" ]; then \
echo "error: the core differs from the xhandler-rust $(TAG) release (now synced here):" >&2; \
Expand Down
97 changes: 0 additions & 97 deletions hack/core.sh

This file was deleted.

Loading