mod makefile and install script for linux x86
This commit is contained in:
@@ -82,6 +82,11 @@ help:
|
|||||||
@echo " • vendor-linux works on any platform with Docker"
|
@echo " • vendor-linux works on any platform with Docker"
|
||||||
@echo " • binary-linux works on any platform with Docker"
|
@echo " • binary-linux works on any platform with Docker"
|
||||||
@echo " • All other targets work on macOS and Linux"
|
@echo " • All other targets work on macOS and Linux"
|
||||||
|
@echo "🛠️ Development workflow (works on macOS + Linux):"
|
||||||
|
@echo " make install-dev - Create venv and install dev dependencies (includes pytest)"
|
||||||
|
@echo " make install - Create venv and install production dependencies only"
|
||||||
|
@echo " make test - Run test suite (requires install-dev)"
|
||||||
|
@echo " make test-all - Install dev deps + run all tests"
|
||||||
|
|
||||||
|
|
||||||
# ---------- Build reusable image ----------
|
# ---------- Build reusable image ----------
|
||||||
@@ -103,22 +108,34 @@ vendor-macos: requirements.txt
|
|||||||
cd $(VENDOR_MACOS) && shasum -a 256 *.whl > SHA256SUMS
|
cd $(VENDOR_MACOS) && shasum -a 256 *.whl > SHA256SUMS
|
||||||
@echo "✓ macOS ARM64 wheels: $(VENDOR_MACOS)/"
|
@echo "✓ macOS ARM64 wheels: $(VENDOR_MACOS)/"
|
||||||
|
|
||||||
.PHONY: vendor-linux
|
.PHONY: vendor-linux-dev
|
||||||
vendor-linux: requirements.txt build-image
|
vendor-linux-dev: requirements-dev.txt
|
||||||
@echo "Building Linux x86_64 wheels (Docker)..."
|
@echo "Building Linux x86_64 dev wheels (Docker)..."
|
||||||
mkdir -p $(VENDOR_LINUX)
|
mkdir -p $(VENDOR_LINUX)-dev
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
|
--platform linux/amd64 \
|
||||||
-v "$$PWD":$(WORKDIR) \
|
-v "$$PWD":$(WORKDIR) \
|
||||||
-w $(WORKDIR) \
|
-w $(WORKDIR) \
|
||||||
$(IMAGE) \
|
python:3.12-slim \
|
||||||
bash -c " \
|
bash -c " \
|
||||||
|
set -e && \
|
||||||
|
apt-get update -qq && apt-get install -y -qq gcc g++ make libffi-dev && \
|
||||||
pip install --upgrade pip && \
|
pip install --upgrade pip && \
|
||||||
pip download --dest $(VENDOR_LINUX) -r requirements.txt && \
|
pip download --dest $(VENDOR_LINUX)-dev -r requirements-dev.txt && \
|
||||||
pip wheel --wheel-dir $(VENDOR_LINUX) --no-deps $(VENDOR_LINUX)/*.tar.gz 2>/dev/null || true && \
|
pip wheel --wheel-dir $(VENDOR_LINUX)-dev --no-deps $(VENDOR_LINUX)-dev/*.tar.gz 2>/dev/null || true && \
|
||||||
rm -f $(VENDOR_LINUX)/*.tar.gz && \
|
rm -f $(VENDOR_LINUX)-dev/*.tar.gz && \
|
||||||
cd $(VENDOR_LINUX) && sha256sum *.whl > SHA256SUMS \
|
cd $(VENDOR_LINUX)-dev && sha256sum *.whl > SHA256SUMS \
|
||||||
"
|
"
|
||||||
@echo "✓ Linux x86_64 wheels: $(VENDOR_LINUX)/"
|
@echo "✓ Linux x86_64 dev wheels: $(VENDOR_LINUX)-dev/"
|
||||||
|
|
||||||
|
.PHONY: vendor-all-dev
|
||||||
|
vendor-all-dev: vendor-linux vendor-linux-dev
|
||||||
|
@echo ""
|
||||||
|
@echo "✓ All platform wheels (runtime + dev):"
|
||||||
|
@echo " Linux x86_64 (runtime): $(VENDOR_LINUX)/"
|
||||||
|
@echo " Linux x86_64 (dev): $(VENDOR_LINUX)-dev/"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: vendor-all
|
.PHONY: vendor-all
|
||||||
vendor-all: vendor-macos vendor-linux
|
vendor-all: vendor-macos vendor-linux
|
||||||
@@ -216,6 +233,27 @@ test:
|
|||||||
pytest -v tests/test_vectors.py && \
|
pytest -v tests/test_vectors.py && \
|
||||||
python src/pyhdwallet.py test
|
python src/pyhdwallet.py test
|
||||||
|
|
||||||
|
.PHONY: install-dev
|
||||||
|
install-dev: requirements-dev.txt
|
||||||
|
@if [ ! -d "$(VENV_HOST)" ]; then \
|
||||||
|
echo "Creating venv: $(VENV_HOST)"; \
|
||||||
|
python3.12 -m venv $(VENV_HOST); \
|
||||||
|
fi
|
||||||
|
. $(VENV_HOST)/bin/activate && \
|
||||||
|
pip install --upgrade pip && \
|
||||||
|
pip install -r requirements-dev.txt && \
|
||||||
|
echo "✓ Development environment ready: $(VENV_HOST)" && \
|
||||||
|
echo " Installed: production deps + pytest"
|
||||||
|
|
||||||
|
.PHONY: test-all
|
||||||
|
test-all: install-dev
|
||||||
|
@. $(VENV_HOST)/bin/activate && \
|
||||||
|
pytest -v tests/test_vectors.py && \
|
||||||
|
python src/pyhdwallet.py test && \
|
||||||
|
echo "" && \
|
||||||
|
echo "✅ All tests passed!"
|
||||||
|
|
||||||
|
|
||||||
# ---------- Warm container lifecycle ----------
|
# ---------- Warm container lifecycle ----------
|
||||||
.PHONY: up
|
.PHONY: up
|
||||||
up: build-image
|
up: build-image
|
||||||
|
|||||||
+360
-106
@@ -1,125 +1,379 @@
|
|||||||
#!/bin/bash
|
# Makefile for hdwalletpy workflow
|
||||||
set -e
|
# - Build reusable Docker image (Python 3.12)
|
||||||
|
# - Vendor multi-platform wheels for offline air-gapped use
|
||||||
|
# - Compile wheels in container (wheelhouse)
|
||||||
|
# - Create host venv and install from wheelhouse or vendor/
|
||||||
|
# - Optionally run inside a warm container
|
||||||
|
|
||||||
# Detect platform
|
# ---------- Platform Detection ----------
|
||||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
UNAME_S := $(shell uname -s)
|
||||||
PLATFORM="linux-x86_64"
|
UNAME_M := $(shell uname -m)
|
||||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
|
||||||
ARCH=$(uname -m)
|
ifeq ($(UNAME_S),Darwin)
|
||||||
if [[ "$ARCH" == "arm64" ]]; then
|
PLATFORM := macos
|
||||||
PLATFORM="macos-arm64"
|
ifeq ($(UNAME_M),arm64)
|
||||||
|
ARCH := arm64
|
||||||
else
|
else
|
||||||
echo "ERROR: Only macOS ARM64 is supported"
|
$(error Unsupported macOS architecture: $(UNAME_M))
|
||||||
exit 1
|
endif
|
||||||
fi
|
else ifeq ($(UNAME_S),Linux)
|
||||||
|
PLATFORM := linux
|
||||||
|
ARCH := x86_64
|
||||||
else
|
else
|
||||||
echo "ERROR: Unsupported platform: $OSTYPE"
|
$(error Unsupported OS: $(UNAME_S))
|
||||||
exit 1
|
endif
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Detected platform: $PLATFORM"
|
VENDOR_DIR := vendor/$(PLATFORM)-$(ARCH)
|
||||||
|
|
||||||
# Check if vendor directory exists
|
# ---------- Config ----------
|
||||||
if [ ! -d "vendor/$PLATFORM" ]; then
|
IMAGE := hdwallet-build:3.12
|
||||||
echo "ERROR: vendor/$PLATFORM not found!"
|
CONTAINER := hdwallet-dev
|
||||||
echo "Run ./build-vendors-simple.sh to generate wheels"
|
WORKDIR := /app
|
||||||
exit 1
|
VENV_HOST := .venv
|
||||||
fi
|
VENV_CONTAINER := /opt/venv
|
||||||
|
WHEELHOUSE := wheelhouse
|
||||||
|
|
||||||
# Check for Python 3.12
|
# Vendor directories for air-gapped deployment
|
||||||
if ! command -v python3.12 &> /dev/null; then
|
VENDOR_MACOS := vendor/macos-arm64
|
||||||
echo "ERROR: Python 3.12 not found!"
|
VENDOR_LINUX := vendor/linux-x86_64
|
||||||
echo "Please install Python 3.12:"
|
|
||||||
echo " macOS: brew install python@3.12"
|
|
||||||
echo " Linux: apt-get install python3.12 python3.12-venv"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if already in a venv
|
# ---------- Help ----------
|
||||||
if [ -n "$VIRTUAL_ENV" ]; then
|
.PHONY: help
|
||||||
CURRENT_PYTHON=$(python --version 2>&1 | grep -oE '3\.[0-9]+')
|
help:
|
||||||
if [[ "$CURRENT_PYTHON" != "3.12" ]]; then
|
@echo "pyhdwallet build system (macOS + Linux compatible)"
|
||||||
echo "WARNING: You are in a venv with Python $CURRENT_PYTHON"
|
@echo ""
|
||||||
echo "Deactivating and creating new Python 3.12 venv..."
|
@echo "📦 Vendoring (for offline/air-gapped use):"
|
||||||
deactivate || true
|
@echo " make vendor-macos - Build macOS ARM64 wheels (requires macOS native)"
|
||||||
else
|
@echo " make vendor-linux - Build Linux x86_64 wheels (Docker - any OS)"
|
||||||
echo "Already in Python 3.12 venv, using it..."
|
@echo " make vendor-linux-dev - Build Linux x86_64 dev wheels (includes pytest)"
|
||||||
fi
|
@echo " make vendor-all - Build runtime wheels for both platforms"
|
||||||
fi
|
@echo " make vendor-all-dev - Build runtime + dev wheels for all platforms"
|
||||||
|
@echo " make verify-vendor - Test offline installation from vendor/"
|
||||||
|
@echo ""
|
||||||
|
@echo "🔨 Binary Distribution:"
|
||||||
|
@echo " make binary - Build standalone binary for current platform"
|
||||||
|
@echo " make binary-linux - Build Linux binary via Docker (any OS)"
|
||||||
|
@echo " make binary-all - Build binaries for all platforms"
|
||||||
|
@echo ""
|
||||||
|
@echo "🚀 Release Management:"
|
||||||
|
@echo " make release - Build complete release (binaries + vendors + checksums)"
|
||||||
|
@echo " make release-binaries - Copy binaries to releases/vX.Y.Z/"
|
||||||
|
@echo " make release-checksums - Generate SHA256SUMS for binaries"
|
||||||
|
@echo " make release-test - Test release binaries"
|
||||||
|
@echo " make clean-release - Remove all release artifacts"
|
||||||
|
@echo ""
|
||||||
|
@echo "🛠️ Development workflow (works on macOS + Linux):"
|
||||||
|
@echo " make install - Create venv and install runtime dependencies"
|
||||||
|
@echo " make install-offline - Install runtime deps from vendor/ (offline)"
|
||||||
|
@echo " make install-dev-offline - Install runtime + dev deps from vendor/ (offline)"
|
||||||
|
@echo " make test - Run test suite"
|
||||||
|
@echo " make build-image - Build Docker image (Python 3.12)"
|
||||||
|
@echo " make wheels - Build wheels into ./$(WHEELHOUSE)"
|
||||||
|
@echo " make up - Start warm dev container"
|
||||||
|
@echo " make shell - Open shell in warm container"
|
||||||
|
@echo " make down - Stop and remove dev container"
|
||||||
|
@echo ""
|
||||||
|
@echo "🧹 Cleanup:"
|
||||||
|
@echo " make clean - Remove venv, wheelhouse (keeps vendor/)"
|
||||||
|
@echo " make clean-vendor - Remove vendor/ only"
|
||||||
|
@echo " make clean-release - Remove releases/ only"
|
||||||
|
@echo ""
|
||||||
|
@echo "ℹ️ Platform Info:"
|
||||||
|
@echo " make info - Show platform detection info"
|
||||||
|
@echo ""
|
||||||
|
@echo "Platform notes:"
|
||||||
|
@echo " • vendor-macos requires native macOS (uses .venv312 with ARM64 Python)"
|
||||||
|
@echo " • vendor-linux works on any platform with Docker"
|
||||||
|
@echo " • vendor-linux-dev includes pytest for offline development"
|
||||||
|
@echo " • binary-linux works on any platform with Docker"
|
||||||
|
@echo " • All other targets work on macOS and Linux"
|
||||||
|
|
||||||
# Create or use existing venv
|
# ---------- Build reusable image ----------
|
||||||
VENV_DIR=".venv"
|
.PHONY: build-image
|
||||||
if [ ! -d "$VENV_DIR" ] || [ ! -f "$VENV_DIR/bin/python3.12" ]; then
|
build-image:
|
||||||
echo "Creating Python 3.12 virtual environment..."
|
docker build -t $(IMAGE) .
|
||||||
python3.12 -m venv "$VENV_DIR"
|
|
||||||
echo "✓ Virtual environment created: $VENV_DIR"
|
# ---------- Vendoring for Air-Gapped Use ----------
|
||||||
|
.PHONY: vendor-macos
|
||||||
|
vendor-macos: requirements.txt
|
||||||
|
@echo "Building macOS ARM64 wheels (native)..."
|
||||||
|
@if [ ! -f ".venv312/bin/pip" ]; then \
|
||||||
|
echo "ERROR: .venv312 not found. Create it first:"; \
|
||||||
|
echo " python3.12 -m venv .venv312 && source .venv312/bin/activate"; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
mkdir -p $(VENDOR_MACOS)
|
||||||
|
.venv312/bin/pip download --dest $(VENDOR_MACOS) -r requirements.txt
|
||||||
|
cd $(VENDOR_MACOS) && shasum -a 256 *.whl > SHA256SUMS
|
||||||
|
@echo "✓ macOS ARM64 wheels: $(VENDOR_MACOS)/"
|
||||||
|
|
||||||
|
.PHONY: vendor-linux
|
||||||
|
vendor-linux: requirements.txt
|
||||||
|
@echo "Building Linux x86_64 wheels (Docker)..."
|
||||||
|
mkdir -p $(VENDOR_LINUX)
|
||||||
|
docker run --rm \
|
||||||
|
--platform linux/amd64 \
|
||||||
|
-v "$$PWD":$(WORKDIR) \
|
||||||
|
-w $(WORKDIR) \
|
||||||
|
python:3.12-slim \
|
||||||
|
bash -c " \
|
||||||
|
set -e && \
|
||||||
|
apt-get update -qq && apt-get install -y -qq gcc g++ make libffi-dev && \
|
||||||
|
pip install --upgrade pip && \
|
||||||
|
pip download --dest $(VENDOR_LINUX) -r requirements.txt && \
|
||||||
|
pip wheel --wheel-dir $(VENDOR_LINUX) --no-deps $(VENDOR_LINUX)/*.tar.gz 2>/dev/null || true && \
|
||||||
|
rm -f $(VENDOR_LINUX)/*.tar.gz && \
|
||||||
|
cd $(VENDOR_LINUX) && sha256sum *.whl > SHA256SUMS \
|
||||||
|
"
|
||||||
|
@echo "✓ Linux x86_64 wheels: $(VENDOR_LINUX)/"
|
||||||
|
|
||||||
|
.PHONY: vendor-linux-dev
|
||||||
|
vendor-linux-dev: requirements-dev.txt
|
||||||
|
@echo "Building Linux x86_64 dev wheels (Docker)..."
|
||||||
|
mkdir -p $(VENDOR_LINUX)-dev
|
||||||
|
docker run --rm \
|
||||||
|
--platform linux/amd64 \
|
||||||
|
-v "$$PWD":$(WORKDIR) \
|
||||||
|
-w $(WORKDIR) \
|
||||||
|
python:3.12-slim \
|
||||||
|
bash -c " \
|
||||||
|
set -e && \
|
||||||
|
apt-get update -qq && apt-get install -y -qq gcc g++ make libffi-dev && \
|
||||||
|
pip install --upgrade pip && \
|
||||||
|
pip download --dest $(VENDOR_LINUX)-dev -r requirements-dev.txt && \
|
||||||
|
pip wheel --wheel-dir $(VENDOR_LINUX)-dev --no-deps $(VENDOR_LINUX)-dev/*.tar.gz 2>/dev/null || true && \
|
||||||
|
rm -f $(VENDOR_LINUX)-dev/*.tar.gz && \
|
||||||
|
cd $(VENDOR_LINUX)-dev && sha256sum *.whl > SHA256SUMS \
|
||||||
|
"
|
||||||
|
@echo "✓ Linux x86_64 dev wheels: $(VENDOR_LINUX)-dev/"
|
||||||
|
|
||||||
|
.PHONY: vendor-all
|
||||||
|
vendor-all: vendor-macos vendor-linux
|
||||||
|
@echo ""
|
||||||
|
@echo "✓ All platforms vendored (runtime only):"
|
||||||
|
@echo " macOS ARM64: $(VENDOR_MACOS)/ ($$(ls $(VENDOR_MACOS)/*.whl 2>/dev/null | wc -l | xargs) wheels)"
|
||||||
|
@echo " Linux x86_64: $(VENDOR_LINUX)/ ($$(ls $(VENDOR_LINUX)/*.whl 2>/dev/null | wc -l | xargs) wheels)"
|
||||||
|
@echo ""
|
||||||
|
@echo "Commit with: git add vendor/ && git commit -m 'vendor: update wheels'"
|
||||||
|
|
||||||
|
.PHONY: vendor-all-dev
|
||||||
|
vendor-all-dev: vendor-linux vendor-linux-dev
|
||||||
|
@echo ""
|
||||||
|
@echo "✓ All platform wheels (runtime + dev):"
|
||||||
|
@echo " Linux x86_64 (runtime): $(VENDOR_LINUX)/ ($$(ls $(VENDOR_LINUX)/*.whl 2>/dev/null | wc -l | xargs) wheels)"
|
||||||
|
@echo " Linux x86_64 (dev): $(VENDOR_LINUX)-dev/ ($$(ls $(VENDOR_LINUX)-dev/*.whl 2>/dev/null | wc -l | xargs) wheels)"
|
||||||
|
@echo ""
|
||||||
|
@echo "For macOS dev wheels, run on native macOS:"
|
||||||
|
@echo " python3.12 -m venv .venv312 && source .venv312/bin/activate"
|
||||||
|
@echo " pip download --dest vendor/macos-arm64-dev -r requirements-dev.txt"
|
||||||
|
|
||||||
|
.PHONY: verify-vendor
|
||||||
|
verify-vendor:
|
||||||
|
@echo "Testing offline installation from vendor/..."
|
||||||
|
@bash -c ' \
|
||||||
|
if [[ "$$OSTYPE" == "darwin"* ]]; then \
|
||||||
|
PLATFORM="macos-arm64"; \
|
||||||
|
else \
|
||||||
|
PLATFORM="linux-x86_64"; \
|
||||||
|
fi; \
|
||||||
|
echo "Platform: $$PLATFORM"; \
|
||||||
|
python3.12 -m venv .venv-verify && \
|
||||||
|
source .venv-verify/bin/activate && \
|
||||||
|
pip install --no-index --find-links=vendor/$$PLATFORM -r requirements.txt && \
|
||||||
|
python src/pyhdwallet.py test && \
|
||||||
|
echo "" && \
|
||||||
|
echo "✅ Vendor installation verified!" && \
|
||||||
|
deactivate && \
|
||||||
|
rm -rf .venv-verify \
|
||||||
|
'
|
||||||
|
|
||||||
|
# ---------- Offline Installation ----------
|
||||||
|
.PHONY: install-offline
|
||||||
|
install-offline:
|
||||||
|
@echo "Installing from vendor/ (runtime only)..."
|
||||||
|
@./install_offline.sh
|
||||||
|
|
||||||
|
.PHONY: install-dev-offline
|
||||||
|
install-dev-offline:
|
||||||
|
@echo "Installing from vendor/ (dev mode with pytest)..."
|
||||||
|
@./install_offline.sh --dev
|
||||||
|
|
||||||
|
# ---------- Binary Building ----------
|
||||||
|
.PHONY: binary
|
||||||
|
binary:
|
||||||
|
@echo "🔨 Building binary for current platform: $(PLATFORM)-$(ARCH)..."
|
||||||
|
ifeq ($(PLATFORM),macos)
|
||||||
|
@if [ ! -f "build_binary.sh" ]; then \
|
||||||
|
echo "❌ build_binary.sh not found!"; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
@bash build_binary.sh
|
||||||
else
|
else
|
||||||
echo "Using existing venv: $VENV_DIR"
|
@echo "⚠️ For Linux native builds, use build_binary.sh directly"
|
||||||
fi
|
@echo " Or use: make binary-linux (builds via Docker)"
|
||||||
|
endif
|
||||||
|
|
||||||
# Activate venv
|
.PHONY: binary-linux
|
||||||
source "$VENV_DIR/bin/activate"
|
binary-linux:
|
||||||
|
@./build_binary_linux.sh
|
||||||
|
|
||||||
# Verify Python version
|
.PHONY: binary-all
|
||||||
PYTHON_VERSION=$(python --version 2>&1 | grep -oE '3\.[0-9]+')
|
binary-all:
|
||||||
echo "Using Python $PYTHON_VERSION from: $(which python)"
|
@echo "🏗️ Building binaries for all platforms..."
|
||||||
|
@echo ""
|
||||||
|
@echo "1️⃣ Building native binary..."
|
||||||
|
@$(MAKE) binary
|
||||||
|
@echo ""
|
||||||
|
@echo "2️⃣ Building Linux binary via Docker..."
|
||||||
|
@$(MAKE) binary-linux
|
||||||
|
@echo ""
|
||||||
|
@echo "✅ All binaries built:"
|
||||||
|
@ls -lh dist/pyhdwallet* 2>/dev/null | awk '{print " " $$9 " (" $$5 ")"}' || echo " No binaries found"
|
||||||
|
|
||||||
if [[ "$PYTHON_VERSION" != "3.12" ]]; then
|
# ---------- Development Workflow ----------
|
||||||
echo "ERROR: Expected Python 3.12, got $PYTHON_VERSION"
|
.PHONY: wheels
|
||||||
exit 1
|
wheels: requirements.txt build-image
|
||||||
fi
|
docker run --rm \
|
||||||
|
-v "$$PWD":$(WORKDIR) \
|
||||||
|
-w $(WORKDIR) \
|
||||||
|
$(IMAGE) \
|
||||||
|
bash -c " \
|
||||||
|
pip install --upgrade pip setuptools wheel && \
|
||||||
|
mkdir -p $(WHEELHOUSE) && \
|
||||||
|
pip wheel -r requirements.txt -w $(WHEELHOUSE) \
|
||||||
|
"
|
||||||
|
|
||||||
# Verify checksums
|
.PHONY: install
|
||||||
if [ -f "vendor/$PLATFORM/SHA256SUMS" ]; then
|
install: requirements.txt
|
||||||
echo ""
|
@if [ ! -d "$(VENV_HOST)" ]; then \
|
||||||
echo "Verifying checksums..."
|
echo "Creating venv: $(VENV_HOST)"; \
|
||||||
(cd vendor/$PLATFORM && shasum -a 256 -c SHA256SUMS --quiet) || {
|
python3.12 -m venv $(VENV_HOST); \
|
||||||
echo "ERROR: Checksum verification failed!"
|
fi
|
||||||
exit 1
|
. $(VENV_HOST)/bin/activate && \
|
||||||
}
|
pip install --upgrade pip && \
|
||||||
echo "✓ Checksums verified"
|
pip install -r requirements.txt && \
|
||||||
fi
|
echo "✓ Virtual environment ready: $(VENV_HOST)"
|
||||||
|
|
||||||
# Install
|
.PHONY: test
|
||||||
echo ""
|
test:
|
||||||
echo "Installing from vendor/$PLATFORM..."
|
@if [ ! -d "$(VENV_HOST)" ]; then \
|
||||||
pip install --upgrade pip --quiet
|
echo "ERROR: Run 'make install' first"; \
|
||||||
pip install --no-index --find-links=vendor/$PLATFORM -r requirements.txt
|
exit 1; \
|
||||||
|
fi
|
||||||
|
. $(VENV_HOST)/bin/activate && \
|
||||||
|
pytest -v tests/test_vectors.py && \
|
||||||
|
python src/pyhdwallet.py test
|
||||||
|
|
||||||
# Test
|
# ---------- Warm container lifecycle ----------
|
||||||
echo ""
|
.PHONY: up
|
||||||
echo "Running tests..."
|
up: build-image
|
||||||
|
docker run -dit \
|
||||||
|
-v "$$PWD":$(WORKDIR) \
|
||||||
|
-w $(WORKDIR) \
|
||||||
|
--name $(CONTAINER) \
|
||||||
|
$(IMAGE) \
|
||||||
|
bash
|
||||||
|
|
||||||
# Optional: run pytest if available (dev-only)
|
.PHONY: shell
|
||||||
if python -c "import pytest" >/dev/null 2>&1; then
|
shell:
|
||||||
python -m pytest -v tests/test_vectors.py || {
|
docker exec -it $(CONTAINER) bash
|
||||||
echo "ERROR: Tests failed!"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
else
|
|
||||||
echo "⚠️ pytest not installed; skipping pytest suite."
|
|
||||||
echo " (To enable: install dev deps or run 'pip install -r requirements-dev.txt' if available offline.)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo ""
|
.PHONY: down
|
||||||
echo "Running built-in smoke test..."
|
down:
|
||||||
python src/pyhdwallet.py test || {
|
- docker rm -f $(CONTAINER)
|
||||||
echo "ERROR: Smoke test failed!"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
|
# ---------- Cleanup ----------
|
||||||
|
.PHONY: clean-vendor
|
||||||
|
clean-vendor:
|
||||||
|
rm -rf vendor/
|
||||||
|
|
||||||
echo ""
|
.PHONY: clean
|
||||||
echo "=========================================="
|
clean: down
|
||||||
echo "✓ Installation complete and verified!"
|
rm -rf $(VENV_HOST) $(WHEELHOUSE) .venv-verify .venv-offline-test
|
||||||
echo "=========================================="
|
rm -rf dist/ build/ *.spec src/pyhdwallet_frozen.py
|
||||||
echo ""
|
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
|
||||||
echo "Virtual environment: $VENV_DIR"
|
find . -type d -name "*.egg-info" -exec rm -rf {} + 2>/dev/null || true
|
||||||
echo "Python version: $(python --version)"
|
# NOTE: vendor/ is kept (use 'make clean-vendor' to remove)
|
||||||
echo ""
|
|
||||||
echo "To activate this environment:"
|
# ---------- Platform-Aware Operations ----------
|
||||||
echo " source $VENV_DIR/bin/activate"
|
.PHONY: info
|
||||||
echo ""
|
info:
|
||||||
echo "Generate a wallet with:"
|
@echo "Platform Information:"
|
||||||
echo " python src/pyhdwallet.py gen --off-screen --file"
|
@echo " OS: $(PLATFORM)"
|
||||||
echo ""
|
@echo " Architecture: $(ARCH)"
|
||||||
|
@echo " Vendor dir: $(VENDOR_DIR)"
|
||||||
|
@echo " Python: $(shell python3 --version 2>/dev/null || echo 'not found')"
|
||||||
|
@echo " Docker: $(shell docker --version 2>/dev/null || echo 'not found')"
|
||||||
|
|
||||||
|
# ---------- Release Management ----------
|
||||||
|
VERSION := v1.1.0
|
||||||
|
RELEASE_DIR := releases/$(VERSION)
|
||||||
|
|
||||||
|
.PHONY: release-prep
|
||||||
|
release-prep:
|
||||||
|
@echo "📦 Preparing release $(VERSION)..."
|
||||||
|
@mkdir -p $(RELEASE_DIR)
|
||||||
|
|
||||||
|
.PHONY: release-binaries
|
||||||
|
release-binaries: release-prep binary binary-linux
|
||||||
|
@echo "📦 Copying binaries to $(RELEASE_DIR)..."
|
||||||
|
@cp dist/pyhdwallet $(RELEASE_DIR)/pyhdwallet-macos-arm64
|
||||||
|
@cp dist/pyhdwallet-linux $(RELEASE_DIR)/pyhdwallet-linux-x86_64
|
||||||
|
@echo "✅ Binaries copied"
|
||||||
|
|
||||||
|
.PHONY: release-checksums
|
||||||
|
release-checksums: release-binaries
|
||||||
|
@echo "🔐 Generating checksums..."
|
||||||
|
@cd $(RELEASE_DIR) && shasum -a 256 pyhdwallet-* > SHA256SUMS
|
||||||
|
@echo "✅ Checksums generated:"
|
||||||
|
@cat $(RELEASE_DIR)/SHA256SUMS
|
||||||
|
|
||||||
|
.PHONY: release-vendors
|
||||||
|
release-vendors: release-prep vendor-all
|
||||||
|
@echo "📦 Copying vendor wheels to $(RELEASE_DIR)..."
|
||||||
|
@mkdir -p $(RELEASE_DIR)/vendor
|
||||||
|
@cp -r vendor/macos-arm64 $(RELEASE_DIR)/vendor/
|
||||||
|
@cp -r vendor/linux-x86_64 $(RELEASE_DIR)/vendor/
|
||||||
|
@echo "✅ Vendor wheels copied"
|
||||||
|
|
||||||
|
.PHONY: release
|
||||||
|
release: release-checksums
|
||||||
|
@echo ""
|
||||||
|
@echo "🎉 Release $(VERSION) binaries ready!"
|
||||||
|
@echo ""
|
||||||
|
@if [ -d ".venv312" ]; then \
|
||||||
|
echo "📦 Building vendor wheels..."; \
|
||||||
|
$(MAKE) release-vendors; \
|
||||||
|
else \
|
||||||
|
echo "⚠️ Skipping vendor wheels (.venv312 not found)"; \
|
||||||
|
echo " To include vendors: python3.12 -m venv .venv312 && make release-vendors"; \
|
||||||
|
fi
|
||||||
|
@echo ""
|
||||||
|
@echo "Contents:"
|
||||||
|
@ls -lh $(RELEASE_DIR)/ | tail -n +2
|
||||||
|
@echo ""
|
||||||
|
@cat $(RELEASE_DIR)/SHA256SUMS
|
||||||
|
@echo ""
|
||||||
|
@echo "Next steps:"
|
||||||
|
@echo " 1. Test: make release-test"
|
||||||
|
@echo " 2. Tag: git tag -a $(VERSION) -m 'Release $(VERSION)'"
|
||||||
|
@echo " 3. Push: git push origin $(VERSION)"
|
||||||
|
|
||||||
|
.PHONY: release-test
|
||||||
|
release-test:
|
||||||
|
@echo "🧪 Testing release binaries..."
|
||||||
|
@echo ""
|
||||||
|
@echo "Testing macOS binary:"
|
||||||
|
@$(RELEASE_DIR)/pyhdwallet-macos-arm64 test || echo "⚠️ macOS binary test skipped (wrong platform)"
|
||||||
|
@echo ""
|
||||||
|
@echo "Testing Linux binary (via Docker):"
|
||||||
|
@docker run --rm --platform linux/amd64 \
|
||||||
|
-v "$$PWD/$(RELEASE_DIR)":/binaries \
|
||||||
|
ubuntu:22.04 \
|
||||||
|
/binaries/pyhdwallet-linux-x86_64 test
|
||||||
|
|
||||||
|
.PHONY: clean-release
|
||||||
|
clean-release:
|
||||||
|
@echo "🧹 Cleaning release artifacts..."
|
||||||
|
@rm -rf releases/
|
||||||
|
@echo "✅ Release artifacts cleaned"
|
||||||
|
|||||||
Vendored
+11
-11
@@ -1,18 +1,18 @@
|
|||||||
11a36f4d3ce51dfc1043f3218591ac4eb1ceb172919cebe05b52a5bcc8d245c2 base58-2.1.1-py3-none-any.whl
|
11a36f4d3ce51dfc1043f3218591ac4eb1ceb172919cebe05b52a5bcc8d245c2 base58-2.1.1-py3-none-any.whl
|
||||||
33792674bda552a071a539b6590b2986aa8c08d0c9c30c2566d7cb323173310d bip_utils-2.10.0-py3-none-any.whl
|
33792674bda552a071a539b6590b2986aa8c08d0c9c30c2566d7cb323173310d bip_utils-2.10.0-py3-none-any.whl
|
||||||
518c118a5e00001854adb51f3164e647aa99b6a9877d2a733a28cb5c0a4d6857 cbor2-5.8.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
|
cff2a1999e49cd51c23d1b6786a012127fd8f722c5946e82bd7ab3eb307443f3 cbor2-5.8.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
|
||||||
b21e08af67b8a103c71a250401c78d5e0893beff75e28c53c98f4de42f774062 cffi-2.0.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
|
3e17ed538242334bf70832644a32a7aae3d83b57567f9fd60a26257e992b79ba cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
|
||||||
5a366c314df7217e3357bb8c7d2cda540b0bce180705f7a0ce2d1d9e28f62ad4 coincurve-21.0.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
|
1b04778b75339c6e46deb9ae3bcfc2250fbe48d1324153e4310fc4996e135715 coincurve-21.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
|
||||||
1ef255bb24cb5116c7e6c83cf284db2146f0158b1fbe8c63ad7b1df214d141ba crcmod-1.7-cp312-cp312-linux_aarch64.whl
|
e68035c5d2329b0bea290d95bf5e6bc769ef037e39ec8e3903ddcb7b8520551d crcmod-1.7-cp312-cp312-linux_x86_64.whl
|
||||||
549e234ff32571b1f4076ac269fcce7a808d3bf98b76c8dd560e42dbc66d7d91 cryptography-46.0.3-cp311-abi3-manylinux_2_34_aarch64.whl
|
10b01676fc208c3e6feeb25a8b83d81767e8059e1fe86e1dc62d10a3018fa926 cryptography-46.0.3-cp311-abi3-manylinux_2_34_x86_64.whl
|
||||||
30638e27cf77b7e15c4c4cc1973720149e1033827cfd00661ca5c8cc0cdb24c3 ecdsa-0.19.1-py2.py3-none-any.whl
|
30638e27cf77b7e15c4c4cc1973720149e1033827cfd00661ca5c8cc0cdb24c3 ecdsa-0.19.1-py2.py3-none-any.whl
|
||||||
c2695b1eac2f6bda962450def9f92639532630e2a8ba694bc56db3f9aa9454da ed25519_blake2b-1.4.1-cp312-cp312-linux_aarch64.whl
|
7b0c7960b802a605bf5ae8dcf03af34f711087b503b3c96ffec7368dd49372c8 ed25519_blake2b-1.4.1-cp312-cp312-linux_x86_64.whl
|
||||||
eb3aa8bcaf699be242e9c5e152cc5da37bc1dceb697454cd1b596cdb10f54f3c pgpy-0.6.0-py3-none-any.whl
|
2e718c0651f6921eb7f48a1355331757defcb8e588864383d189c796cc25ab03 pgpy-0.6.0-py3-none-any.whl
|
||||||
a3929c291408e67a1a11566f251b9f7d06c3fb3ae240caec44b9181de09e3fc9 py_sr25519_bindings-0.2.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
|
9da4c9c7f9a0a0e8e3d9ed6eedc885561288edd72267ebc7b0fd11262e8c8b28 py_sr25519_bindings-0.2.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
|
||||||
0d632f46f2ba09143da3a8afe9e33fb6f92fa2320ab7e886e2d0f7672af84629 pyasn1-0.6.1-py3-none-any.whl
|
0d632f46f2ba09143da3a8afe9e33fb6f92fa2320ab7e886e2d0f7672af84629 pyasn1-0.6.1-py3-none-any.whl
|
||||||
e5c6e8d3fbad53479cab09ac03729e0a9faf2bee3db8208a550daf5af81a5934 pycparser-2.23-py3-none-any.whl
|
e5c6e8d3fbad53479cab09ac03729e0a9faf2bee3db8208a550daf5af81a5934 pycparser-2.23-py3-none-any.whl
|
||||||
67bd81fcbe34f43ad9422ee8fd4843c8e7198dd88dd3d40e6de42ee65fbe1490 pycryptodome-3.23.0-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
|
c8987bd3307a39bc03df5c8e0e3d8be0c4c3518b7f044b0f4c15d1aa78f52575 pycryptodome-3.23.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
|
||||||
43c446e2ba8df8889e0e16f02211c25b4934898384c1ec1ec04d7889c0333587 pycryptodomex-3.23.0-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
|
f489c4765093fb60e2edafdf223397bc716491b2b69fe74367b70d6999257a5c pycryptodomex-3.23.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
|
||||||
26bfcd00dcf2cf160f122186af731ae30ab120c18e8375684ec2670dccd28130 pynacl-1.6.2-cp38-abi3-manylinux_2_34_aarch64.whl
|
c8a231e36ec2cab018c4ad4358c386e36eede0319a0c41fed24f840b1dac59f6 pynacl-1.6.2-cp38-abi3-manylinux_2_34_x86_64.whl
|
||||||
6d097f465bfa47796b1494e12ea65d1478107d38e13bc56f6e58eedc4f6c1a87 pyzipper-0.3.6-py2.py3-none-any.whl
|
6d097f465bfa47796b1494e12ea65d1478107d38e13bc56f6e58eedc4f6c1a87 pyzipper-0.3.6-py2.py3-none-any.whl
|
||||||
4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274 six-1.17.0-py2.py3-none-any.whl
|
4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274 six-1.17.0-py2.py3-none-any.whl
|
||||||
|
|||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user