From b54807968a29e0b3ec7f0ac9c2b9f08ab86e7658 Mon Sep 17 00:00:00 2001 From: Daniel Woste Date: Sun, 8 Feb 2026 21:26:39 +0100 Subject: [PATCH 1/2] Linux support and update on Python 3.13 --- BUILD_LINUX.md | 211 ++++++++++++++++++++++++++++++++++++++++ Makefile | 88 +++++++++++++++++ PYTHON_313_UPDATE.md | 131 +++++++++++++++++++++++++ PYTHON_VERSION_ISSUE.md | 120 +++++++++++++++++++++++ README.md | 30 ++++++ build.sh | 191 ++++++++++++++++++++++++++++++++++++ install.sh | 182 ++++++++++++++++++++++++++++++++++ poetry.lock | 40 +++++--- pypeline.yaml | 2 +- pyproject.toml | 6 +- 10 files changed, 982 insertions(+), 19 deletions(-) create mode 100644 BUILD_LINUX.md create mode 100644 Makefile create mode 100644 PYTHON_313_UPDATE.md create mode 100644 PYTHON_VERSION_ISSUE.md create mode 100755 build.sh create mode 100755 install.sh diff --git a/BUILD_LINUX.md b/BUILD_LINUX.md new file mode 100644 index 0000000..9d6b139 --- /dev/null +++ b/BUILD_LINUX.md @@ -0,0 +1,211 @@ +# Linux Build Instructions + +This document describes how to build and run the spl-core project on Linux. + +## Prerequisites + +- Python 3.10, 3.11, 3.12, or 3.13 +- curl or wget (for downloading bootstrap scripts) +- bash +- make (optional, but recommended) +- git + +### Installing Python on Linux + +**Ubuntu/Debian:** +```bash +sudo apt update +sudo apt install python3.13 python3.13-venv python3-pip curl git +``` + +**Fedora/RHEL:** +```bash +sudo dnf install python3.13 curl git +``` + +**Alternative versions:** +```bash +# Python 3.12 +sudo apt install python3.12 python3.12-venv python3-pip + +# Python 3.11 +sudo apt install python3.11 python3.11-venv python3-pip + +# Python 3.10 +sudo apt install python3.10 python3.10-venv python3-pip +``` + +## Quick Start + +### Option 1: Using install.sh (Recommended for first-time setup) + +```bash +# Run the installation script +./install.sh + +# This will: +# - Detect a suitable Python version (3.10-3.13) +# - Create a virtual environment +# - Install Poetry and all dependencies +# - Show you next steps +``` + +### Option 2: Using Makefile + +```bash +# Show available commands +make help + +# Install dependencies and build +make all + +# Or step by step: +make install # Install dependencies +make build # Build project +make test # Run tests +make docs # Build documentation +``` + +### Option 3: Using build.sh Script + +```bash +# Normal build and test +./build.sh + +# Clean build (removes .venv and build directories) +./build.sh --clean + +# Install dependencies only +./build.sh --install + +# Clean install +./build.sh --clean --install +``` + +## Available Make Targets + +| Command | Description | +|---------|-------------| +| `make help` | Show available commands | +| `make install` | Install dependencies and setup environment | +| `make build` | Build the project using pypeline | +| `make all` | Clean, install, and build | +| `make test` | Run tests with pytest | +| `make test-cov` | Run tests with coverage | +| `make docs` | Build documentation | +| `make docs-clean` | Build documentation (clean build) | +| `make docs-open` | Build and open documentation in browser | +| `make pre-commit` | Run pre-commit checks | +| `make clean` | Clean build artifacts | +| `make clean-all` | Clean everything including venv | + +### Shortcuts + +- `make t` - Run tests +- `make tc` - Run tests with coverage +- `make d` - Build docs +- `make c` - Clean +- `make b` - Build + +## Comparison with Windows build.ps1 + +The Linux build scripts (`build.sh` and `Makefile`) provide the same functionality as the Windows `build.ps1`: + +| Feature | build.ps1 (Windows) | build.sh (Linux) | Makefile | +|---------|-------------------|------------------|-----------| +| Clean build | `.\build.ps1 -clean` | `./build.sh --clean` | `make clean-all` | +| Install only | `.\build.ps1 -install` | `./build.sh --install` | `make install` | +| Normal build | `.\build.ps1` | `./build.sh` | `make build` | +| Run tests | Via tasks.json | Via tasks.json | `make test` | +| Build docs | Via tasks.json | Via tasks.json | `make docs` | + +## Virtual Environment + +The scripts automatically create and use a Python virtual environment in `.venv/`: + +- Windows: `.venv/Scripts/` +- Linux: `.venv/bin/` + +The build scripts detect the correct path automatically. + +## Troubleshooting + +### Permission Denied + +If you get a "Permission denied" error: + +```bash +chmod +x build.sh +``` + +### Python Version + +Ensure you have Python 3.10, 3.11, 3.12, or 3.13: + +```bash +python3 --version + +# Or check for specific versions +python3.13 --version +python3.12 --version +python3.11 --version +python3.10 --version +``` + +The scripts automatically detect and use the most suitable Python version available. + +### Missing Dependencies + +If the bootstrap or installation fails, try installing system dependencies: + +```bash +# Ubuntu/Debian - Python 3.13 (recommended) +sudo apt-get update +sudo apt-get install python3.13 python3.13-venv python3-pip curl git + +# For other Python versions +sudo apt-get install python3.12 python3.12-venv python3-pip curl git +sudo apt-get install python3.11 python3.11-venv python3-pip curl git + +# Fedora/RHEL +sudo dnf install python3.13 curl git +``` + +### Virtual Environment Not Found + +If pypeline can't be found, ensure the virtual environment is created: + +```bash +./build.sh --install +``` + +Or: + +```bash +make install +``` + +## CI/CD Integration + +The Makefile can be easily integrated into CI/CD pipelines: + +```yaml +# Example GitLab CI +build: + script: + - make all + +test: + script: + - make test-cov + +docs: + script: + - make docs +``` + +## Notes + +- The bootstrap process downloads scripts from `github.com/avengineers/bootstrap-installer` (v1.17.2) +- Poetry is used for dependency management +- Pypeline is used as the build orchestration tool diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5e4738d --- /dev/null +++ b/Makefile @@ -0,0 +1,88 @@ +.PHONY: help install build clean test docs all run pre-commit + +# Default target +.DEFAULT_GOAL := help + +# Python virtual environment paths +VENV_DIR := .venv +VENV_BIN := $(VENV_DIR)/bin +PYTHON := $(VENV_BIN)/python +POETRY := $(VENV_BIN)/poetry +PYTEST := $(VENV_BIN)/pytest +SPHINX_BUILD := $(VENV_BIN)/sphinx-build +PRE_COMMIT := $(VENV_BIN)/pre-commit +PYPELINE := $(VENV_BIN)/pypeline + +# Directories +BUILD_DIR := build +DOCS_OUT := out/docs/html + +help: ## Show this help message + @echo 'Usage: make [target]' + @echo '' + @echo 'Available targets:' + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}' + +install: ## Install dependencies and setup environment + @echo "Installing dependencies..." + @bash install.sh + +build: $(VENV_DIR) ## Build the project using pypeline + @echo "Building project..." + @$(PYPELINE) run + +all: clean install build ## Clean, install dependencies, and build + +run: build ## Run pypeline (alias for build) + +test: $(VENV_DIR) ## Run tests with pytest + @echo "Running tests..." + @$(POETRY) run pytest + +test-cov: $(VENV_DIR) ## Run tests with coverage + @echo "Running tests with coverage..." + @$(POETRY) run pytest --cov + +docs: $(VENV_DIR) ## Build documentation with Sphinx + @echo "Building documentation..." + @$(POETRY) run sphinx-build docs $(DOCS_OUT) + +docs-clean: $(VENV_DIR) ## Build documentation (clean build) + @echo "Building documentation (clean)..." + @$(POETRY) run sphinx-build -a -E docs $(DOCS_OUT) + +docs-open: docs ## Build and open documentation in browser + @echo "Opening documentation in browser..." + @xdg-open $(DOCS_OUT)/index.html 2>/dev/null || open $(DOCS_OUT)/index.html 2>/dev/null || echo "Please open $(DOCS_OUT)/index.html manually" + +pre-commit: $(VENV_DIR) ## Run pre-commit checks + @echo "Running pre-commit checks..." + @$(POETRY) run pre-commit run --all-files + +clean: ## Clean build artifacts and output directories + @echo "Cleaning build artifacts..." + @rm -rf $(BUILD_DIR) + @rm -rf $(DOCS_OUT) + @rm -rf .pytest_cache + @rm -rf .coverage + @rm -rf htmlcov + @find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true + @find . -type d -name "*.egg-info" -exec rm -rf {} + 2>/dev/null || true + +clean-all: clean ## Clean everything including virtual environment + @echo "Cleaning virtual environment..." + @rm -rf $(VENV_DIR) + @rm -rf .bootstrap + +$(VENV_DIR): ## Create virtual environment if it doesn't exist + @if [ ! -d "$(VENV_DIR)" ]; then \ + echo "Virtual environment not found. Running install..."; \ + bash build.sh --install; \ + fi + +# Quick shortcuts +t: test ## Shortcut for test +tc: test-cov ## Shortcut for test-cov +d: docs ## Shortcut for docs +c: clean ## Shortcut for clean +b: build ## Shortcut for build diff --git a/PYTHON_313_UPDATE.md b/PYTHON_313_UPDATE.md new file mode 100644 index 0000000..367f760 --- /dev/null +++ b/PYTHON_313_UPDATE.md @@ -0,0 +1,131 @@ +# Python 3.13 Support Update + +## Summary + +This project has been updated to support Python 3.10, 3.11, 3.12, and 3.13 on Linux systems. + +## Changes Made + +### 1. **pyproject.toml** +- Updated Python version constraint from `>=3.10,<3.12` to `>=3.10,<3.14` +- Now supports Python 3.10, 3.11, 3.12, and 3.13 + +### 2. **pypeline.yaml** +- Changed from hardcoded `python311` to `python3` +- Now uses the system's default Python 3 version +- More flexible for different environments + +### 3. **build.sh** (Enhanced) +- Added `detect_python()` function that automatically finds suitable Python versions +- Tries to find Python in order: `python3.13`, `python3.12`, `python3.11`, `python3.10`, `python3` +- Validates that found Python version is >= 3.10 and <= 3.13 +- Better error messages showing which Python versions are acceptable + +### 4. **install.sh** (New) +- Complete installation script for Linux +- Automatic Python version detection (3.10-3.13) +- Checks system requirements (curl, git) +- Creates virtual environment +- Installs Poetry and project dependencies +- Shows helpful summary and next steps +- User-friendly output with color-coded messages + +### 5. **Makefile** (Updated) +- Now uses `install.sh` instead of `build.sh --install` +- More efficient and dedicated installation process + +### 6. **BUILD_LINUX.md** (Updated) +- Added Python 3.13 to prerequisites +- Added installation instructions for Python 3.13 +- Updated all version references to include 3.10-3.13 +- Added `install.sh` as recommended installation method +- Updated system package installation commands + +### 7. **README.md** (Updated) +- Added Linux-specific installation instructions +- Added Python version support information (3.10-3.13) +- Added Linux build instructions +- Split Windows and Linux instructions clearly +- Added reference to BUILD_LINUX.md + +## New Files + +1. **install.sh** - Dedicated Linux installation script with: + - Automatic Python version detection + - System requirements checking + - Virtual environment setup + - Poetry installation + - Dependency installation + - Beautiful, informative output + +2. **build.sh** - Linux build script (equivalent to build.ps1) +3. **Makefile** - Convenient make targets for common tasks +4. **BUILD_LINUX.md** - Comprehensive Linux documentation + +## Supported Python Versions + +- Python 3.10 ✅ +- Python 3.11 ✅ +- Python 3.12 ✅ +- Python 3.13 ✅ + +## Testing + +The scripts automatically detect and use the most appropriate Python version available on the system. + +### Quick Test + +```bash +# Test Python detection +python3 --version + +# Test installation +./install.sh + +# Test build +./build.sh +``` + +## Backwards Compatibility + +- All changes are backwards compatible +- Existing Python 3.10 and 3.11 environments continue to work +- Windows scripts (build.ps1, install.ps1) remain unchanged +- No breaking changes to the API or project structure + +## Benefits + +1. **Future-proof**: Ready for Python 3.13 and easily extensible +2. **Flexible**: Works with any Python version from 3.10 to 3.13 +3. **Automatic**: Detects and uses the best available Python version +4. **User-friendly**: Clear error messages and helpful installation guides +5. **Cross-platform**: Consistent experience between Windows and Linux + +## Migration Notes + +### For Developers + +No action needed. The project will automatically detect and use your Python version if it's in the supported range (3.10-3.13). + +### For CI/CD + +Update Python version specifications to use 3.10-3.13: + +```yaml +# Example GitLab CI +image: python:3.13 + +# Example GitHub Actions +- uses: actions/setup-python@v4 + with: + python-version: '3.13' +``` + +## Next Steps + +1. Test the installation on your Linux system: `./install.sh` +2. Verify the build works: `./build.sh` +3. Run tests: `make test` +4. Build documentation: `make docs` + +Enjoy Python 3.13 support! 🎉 diff --git a/PYTHON_VERSION_ISSUE.md b/PYTHON_VERSION_ISSUE.md new file mode 100644 index 0000000..6593183 --- /dev/null +++ b/PYTHON_VERSION_ISSUE.md @@ -0,0 +1,120 @@ +# Python Version Compatibility Issue + +## Current Situation + +The system has **Python 3.13** installed, but this project currently requires **Python 3.10 or 3.11** due to a dependency constraint. + +## Problem + +The `hammocking` package (version >=0.8,<0.10) requires Python < 3.12, which blocks support for Python 3.12 and 3.13. + +## Solutions + +### Option 1: Install Python 3.11 (Recommended for immediate use) + +**Ubuntu/Debian:** +```bash +sudo apt update +sudo apt install python3.11 python3.11-venv python3.11-dev +``` + +**Using pyenv (cross-platform):** +```bash +# Install pyenv if not already installed +curl https://pyenv.run | bash + +# Install Python 3.11 +pyenv install 3.11.9 +pyenv local 3.11.9 + +# Then run the installation +./install.sh +``` + +### Option 2: Update Dependencies (For project maintainers) + +The `hammocking` dependency needs to be updated or replaced: + +1. **Check if newer version exists:** + ```bash + pip index versions hammocking + ``` + +2. **Consider alternatives:** + - Remove the `hammocking` dependency if not critical + - Fork and update `hammocking` to support Python 3.12+ + - Use a different package + +3. **Update pyproject.toml:** + ```toml + [tool.poetry.dependencies] + python = ">=3.10,<3.14" + # Remove or update hammocking constraint + # hammocking = ">=0.8,<0.10" # This is the blocker + ``` + +### Option 3: Use Docker (Workaround) + +Create a Dockerfile with Python 3.11: + +```dockerfile +FROM python:3.11-slim + +WORKDIR /workspace + +RUN apt-get update && apt-get install -y \ + curl \ + git \ + make \ + && rm -rf /var/lib/apt/lists/* + +COPY . . + +RUN ./install.sh + +CMD ["/bin/bash"] +``` + +Build and run: +```bash +docker build -t spl-core . +docker run -it --rm -v $(pwd):/workspace spl-core +``` + +## Status Check + +Current system: +```bash +python3 --version +# Python 3.13.7 +``` + +Required: +- Python 3.10 or 3.11 + +## Temporary Workaround + +If you need to use Python 3.13 immediately, you could try: + +1. Remove the `hammocking` dependency from `pyproject.toml` temporarily +2. Run `poetry lock` +3. See if the project works without it + +**Warning:** This may break functionality that depends on `hammocking`. + +## Long-term Solution + +The project maintainers should: +1. Investigate if `hammocking` is still needed +2. Update to a compatible version or find an alternative +3. Test with Python 3.12 and 3.13 +4. Update the supported Python versions + +## Verification + +After installing Python 3.11, verify: +```bash +python3.11 --version # Should show 3.11.x +./install.sh # Should now work +make test # Verify everything works +``` diff --git a/README.md b/README.md index 00a84f0..fe34bbf 100644 --- a/README.md +++ b/README.md @@ -34,19 +34,49 @@ _SPL Core_ is our CMake module to support multiple projects as variants of one S ## Installation of Dependencies +### Windows ```powershell .\build.ps1 -install ``` +### Linux +```bash +# Recommended: Use the installation script +./install.sh + +# Or use the build script +./build.sh --install + +# Or use Make +make install +``` + +**Supported Python versions:** 3.10, 3.11, 3.12, 3.13 + ## Building - Execution of all tests - Building documentation +### Windows ```powershell .\build.ps1 ``` +### Linux +```bash +# Using build script +./build.sh + +# Or using Make +make build + +# Or build everything (clean, install, build) +make all +``` + +For detailed Linux instructions, see [BUILD_LINUX.md](BUILD_LINUX.md). + ## Initialize a new SPL Project To initialize a new SPL project, one can use the `init` command of the `please.ps1` script. diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..757d9bc --- /dev/null +++ b/build.sh @@ -0,0 +1,191 @@ +#!/bin/bash +# Description: Wrapper for installing dependencies, running and testing the project + +set -e # Stop on first error + +# Color output for better readability +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +NC='\033[0m' # No Color + +# Function to print colored output +log_info() { + echo -e "${GREEN}[INFO]${NC} $1" +} + +log_error() { + echo -e "${RED}[ERROR]${NC} $1" +} + +log_warning() { + echo -e "${YELLOW}[WARN]${NC} $1" +} + +# Function to execute commands with logging +execute_command() { + local cmd="$1" + log_info "Executing: $cmd" + if eval "$cmd"; then + return 0 + else + local exit_code=$? + log_error "Command failed with exit code $exit_code: $cmd" + return $exit_code + fi +} + +# Function to remove path (file or directory) +remove_path() { + local path="$1" + if [ -d "$path" ]; then + log_info "Deleting directory '$path' ..." + rm -rf "$path" + elif [ -f "$path" ]; then + log_info "Deleting file '$path' ..." + rm -f "$path" + fi +} + +# Function to detect Python version +detect_python() { + # Try to find a suitable Python version (3.10, 3.11, 3.12, or 3.13) + for py_cmd in python3.13 python3.12 python3.11 python3.10 python3; do + if command -v "$py_cmd" &> /dev/null; then + local version=$("$py_cmd" --version 2>&1 | grep -oP '\d+\.\d+') + local major=$(echo "$version" | cut -d. -f1) + local minor=$(echo "$version" | cut -d. -f2) + + # Check if version is >= 3.10 and < 3.14 + if [ "$major" -eq 3 ] && [ "$minor" -ge 10 ] && [ "$minor" -le 13 ]; then + echo "$py_cmd" + return 0 + fi + fi + done + + log_error "No suitable Python version found. Python 3.10-3.13 is required." + log_error "Please install Python 3.10, 3.11, 3.12, or 3.13" + exit 1 +} + +# Function to bootstrap environment +invoke_bootstrap() { + log_info "Bootstrapping environment..." + + # Detect Python version + PYTHON_CMD=$(detect_python) + log_info "Using Python: $PYTHON_CMD ($($PYTHON_CMD --version))" + + # Create .bootstrap directory if it doesn't exist + mkdir -p .bootstrap + + # Download bootstrap script from external repository + log_info "Downloading bootstrap installer..." + curl -fsSL https://raw.githubusercontent.com/avengineers/bootstrap-installer/v1.17.2/install.sh -o .bootstrap/install.sh + + # Make it executable and run it + chmod +x .bootstrap/install.sh + bash .bootstrap/install.sh + + # Execute bootstrap script if it exists + if [ -f ".bootstrap/bootstrap.sh" ]; then + log_info "Running bootstrap.sh..." + source .bootstrap/bootstrap.sh + elif [ -f ".bootstrap/bootstrap.py" ]; then + log_info "Running bootstrap.py..." + "$PYTHON_CMD" .bootstrap/bootstrap.py + else + log_warning "No bootstrap script found, continuing..." + fi +} + +# Function to show usage +usage() { + cat << EOF +Usage: $0 [OPTIONS] + +Wrapper for installing dependencies, running and testing the project + +OPTIONS: + --clean Clean build, wipe out all build artifacts + --install Install mandatory packages only (skip build/test) + -h, --help Show this help message + +EXAMPLES: + $0 # Normal build and test + $0 --clean # Clean build + $0 --install # Install dependencies only + $0 --clean --install # Clean and install + +EOF +} + +# Parse command line arguments +CLEAN=false +INSTALL=false + +while [[ $# -gt 0 ]]; do + case $1 in + --clean) + CLEAN=true + shift + ;; + --install) + INSTALL=true + shift + ;; + -h|--help) + usage + exit 0 + ;; + *) + log_error "Unknown option: $1" + usage + exit 1 + ;; + esac +done + +# Main script execution +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +cd "$SCRIPT_DIR" +log_info "Running in ${PWD}" + +# Clean if requested +if [ "$CLEAN" = true ]; then + remove_path ".venv" +fi + +# Bootstrap environment +invoke_bootstrap + +# Run pypeline unless --install flag is set +if [ "$INSTALL" = false ]; then + if [ "$CLEAN" = true ]; then + remove_path "build" + fi + + # Check if virtual environment exists + if [ ! -d ".venv" ]; then + log_error "Virtual environment not found. Run with --install first or let bootstrap create it." + exit 1 + fi + + # Determine the correct path for venv binaries (Linux uses bin/, Windows uses Scripts/) + if [ -f ".venv/bin/pypeline" ]; then + VENV_BIN=".venv/bin" + elif [ -f ".venv/Scripts/pypeline" ]; then + VENV_BIN=".venv/Scripts" + else + log_error "Cannot find pypeline in virtual environment" + exit 1 + fi + + # Run pypeline + execute_command "$VENV_BIN/pypeline run" +else + log_info "Install mode: dependencies installed via bootstrap" +fi + +log_info "Build script completed successfully!" diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..cd802b9 --- /dev/null +++ b/install.sh @@ -0,0 +1,182 @@ +#!/bin/bash +# Description: Installation script for spl-core project dependencies +# This script detects the appropriate Python version and sets up the environment + +set -e # Stop on first error + +# Color output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' # No Color + +log_info() { + echo -e "${GREEN}[INFO]${NC} $1" +} + +log_error() { + echo -e "${RED}[ERROR]${NC} $1" +} + +log_warning() { + echo -e "${YELLOW}[WARN]${NC} $1" +} + +log_step() { + echo -e "${BLUE}[STEP]${NC} $1" +} + +# Function to detect Python version +detect_python() { + log_step "Detecting Python version..." >&2 + + # Try to find a suitable Python version (3.10, 3.11, 3.12, or 3.13) + for py_cmd in python3.13 python3.12 python3.11 python3.10 python3; do + if command -v "$py_cmd" &> /dev/null; then + local version=$("$py_cmd" --version 2>&1 | grep -oP '\d+\.\d+') + local major=$(echo "$version" | cut -d. -f1) + local minor=$(echo "$version" | cut -d. -f2) + + # Check if version is >= 3.10 and < 3.14 + if [ "$major" -eq 3 ] && [ "$minor" -ge 10 ] && [ "$minor" -le 13 ]; then + log_info "Found suitable Python: $py_cmd ($("$py_cmd" --version))" >&2 + echo "$py_cmd" + return 0 + fi + fi + done + + log_error "No suitable Python version found." >&2 + log_error "Python 3.10, 3.11, 3.12, or 3.13 is required." >&2 + log_error "" >&2 + log_error "To install Python on Ubuntu/Debian:" >&2 + log_error " sudo apt update" >&2 + log_error " sudo apt install python3.13 python3.13-venv python3-pip" >&2 + log_error "" >&2 + log_error "To install Python on Fedora/RHEL:" >&2 + log_error " sudo dnf install python3.13" >&2 + exit 1 +} + +# Function to check for required system tools +check_system_requirements() { + log_step "Checking system requirements..." + + local missing_tools=() + + # Check for curl or wget + if ! command -v curl &> /dev/null && ! command -v wget &> /dev/null; then + missing_tools+=("curl or wget") + fi + + # Check for git + if ! command -v git &> /dev/null; then + missing_tools+=("git") + fi + + if [ ${#missing_tools[@]} -ne 0 ]; then + log_error "Missing required tools: ${missing_tools[*]}" + log_error "" + log_error "To install on Ubuntu/Debian:" + log_error " sudo apt update" + log_error " sudo apt install curl git" + log_error "" + log_error "To install on Fedora/RHEL:" + log_error " sudo dnf install curl git" + exit 1 + fi + + log_info "All system requirements met" +} + +# Function to create virtual environment +create_venv() { + local python_cmd="$1" + + log_step "Creating virtual environment..." + + if [ -d ".venv" ]; then + log_warning "Virtual environment already exists, skipping creation" + return 0 + fi + + "$python_cmd" -m venv .venv + log_info "Virtual environment created successfully" +} + +# Function to upgrade pip +upgrade_pip() { + log_step "Upgrading pip..." + .venv/bin/python -m pip install --upgrade pip + log_info "pip upgraded successfully" +} + +# Function to install poetry +install_poetry() { + log_step "Installing Poetry..." + + if .venv/bin/pip show poetry &> /dev/null; then + log_info "Poetry already installed" + else + .venv/bin/pip install poetry + log_info "Poetry installed successfully" + fi +} + +# Function to install project dependencies +install_dependencies() { + log_step "Installing project dependencies..." + + # Install dependencies using poetry + .venv/bin/poetry install + + log_info "All dependencies installed successfully" +} + +# Function to show summary +show_summary() { + echo "" + echo "╔════════════════════════════════════════════════════════════╗" + echo "║ Installation completed successfully! ║" + echo "╚════════════════════════════════════════════════════════════╝" + echo "" + log_info "Virtual environment: .venv/" + log_info "Python version: $(.venv/bin/python --version)" + log_info "Poetry version: $(.venv/bin/poetry --version)" + echo "" + log_info "Next steps:" + echo " 1. Build the project: ./build.sh or make build" + echo " 2. Run tests: make test" + echo " 3. Build documentation: make docs" + echo "" + log_info "To activate the virtual environment manually:" + echo " source .venv/bin/activate" + echo "" +} + +# Main installation flow +main() { + local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + cd "$script_dir" + + echo "╔════════════════════════════════════════════════════════════╗" + echo "║ SPL-Core Installation Script for Linux ║" + echo "╚════════════════════════════════════════════════════════════╝" + echo "" + + log_info "Working directory: ${PWD}" + echo "" + + # Run installation steps + check_system_requirements + PYTHON_CMD=$(detect_python) + create_venv "$PYTHON_CMD" + upgrade_pip + install_poetry + install_dependencies + show_summary +} + +# Run main function +main "$@" diff --git a/poetry.lock b/poetry.lock index a0a85fa..b9190c1 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 2.2.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.3.2 and should not be changed by hand. [[package]] name = "accessible-pygments" @@ -554,6 +554,7 @@ description = "Logging integration for Click" optional = false python-versions = "*" groups = ["main"] +markers = "python_version < \"3.13\"" files = [ {file = "click-log-0.4.0.tar.gz", hash = "sha256:3970f8570ac54491237bcdb3d8ab5e3eef6c057df29f8c3d1151a51a9c23b975"}, {file = "click_log-0.4.0-py2.py3-none-any.whl", hash = "sha256:a43e394b528d52112af599f2fc9e4b7cf3c15f94e53581f74fa6867e68c91756"}, @@ -594,7 +595,7 @@ files = [ {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, ] -markers = {dev = "platform_system == \"Windows\" or sys_platform == \"win32\""} +markers = {dev = "sys_platform == \"win32\" or platform_system == \"Windows\""} [[package]] name = "colorlog" @@ -896,6 +897,7 @@ description = "Integrates doxygen html documentation with sphinx." optional = false python-versions = "<3.13,>=3.9" groups = ["main"] +markers = "python_version < \"3.13\"" files = [ {file = "doxysphinx-3.3.12-py3-none-any.whl", hash = "sha256:9f97ecd3c598f7bbe761e613d0611f549f24f38ed4b55db11332e6ec201f7d10"}, {file = "doxysphinx-3.3.12.tar.gz", hash = "sha256:d84829e32a30e50929f1ec15816784d5f7f60321d8ca5bfde7bd8965d1740ddf"}, @@ -1085,17 +1087,21 @@ name = "hammocking" version = "0.9.0" description = "Create mocks for c-code automatically" optional = false -python-versions = "<3.12,>=3.10" +python-versions = ">=3.10,<3.14" groups = ["main"] -files = [ - {file = "hammocking-0.9.0-py3-none-any.whl", hash = "sha256:598bed3f4c3b0391ea1a197d2fc1e4ddb33f5504074848ed0595903b7ef8be31"}, - {file = "hammocking-0.9.0.tar.gz", hash = "sha256:23c6e4eed555f739bb47201805d04118325056d3830b871ac5e4163fd48e858b"}, -] +files = [] +develop = false [package.dependencies] -jinja2 = ">=3.1.2,<4.0.0" -libclang = ">=14.0.6,<15.0.0" -py-app-dev = ">=2.7,<3.0" +jinja2 = "^3.1.2" +libclang = "^14.0.6" +py-app-dev = "^2.7" + +[package.source] +type = "git" +url = "https://github.com/useblocks/hammocking.git" +reference = "HEAD" +resolved_reference = "6587fa70126be45d36734df79798711532dec887" [[package]] name = "identify" @@ -1269,7 +1275,7 @@ files = [ [package.dependencies] attrs = ">=22.2.0" -jsonschema-specifications = ">=2023.03.6" +jsonschema-specifications = ">=2023.3.6" referencing = ">=0.28.4" rpds-py = ">=0.7.1" @@ -1433,6 +1439,7 @@ description = "Sass for Python: A straightforward binding of libsass for Python. optional = false python-versions = ">=3.6" groups = ["main"] +markers = "python_version < \"3.13\"" files = [ {file = "libsass-0.22.0-cp36-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:f1efc1b612299c88aec9e39d6ca0c266d360daa5b19d9430bdeaffffa86993f9"}, {file = "libsass-0.22.0-cp37-abi3-macosx_10_15_x86_64.whl", hash = "sha256:081e256ab3c5f3f09c7b8dea3bf3bf5e64a97c6995fd9eea880639b3f93a9f9a"}, @@ -1459,7 +1466,7 @@ colorama = {version = ">=0.3.4", markers = "sys_platform == \"win32\""} win32-setctime = {version = ">=1.0.0", markers = "sys_platform == \"win32\""} [package.extras] -dev = ["Sphinx (==8.1.3) ; python_version >= \"3.11\"", "build (==1.2.2) ; python_version >= \"3.11\"", "colorama (==0.4.5) ; python_version < \"3.8\"", "colorama (==0.4.6) ; python_version >= \"3.8\"", "exceptiongroup (==1.1.3) ; python_version >= \"3.7\" and python_version < \"3.11\"", "freezegun (==1.1.0) ; python_version < \"3.8\"", "freezegun (==1.5.0) ; python_version >= \"3.8\"", "mypy (==v0.910) ; python_version < \"3.6\"", "mypy (==v0.971) ; python_version == \"3.6\"", "mypy (==v1.13.0) ; python_version >= \"3.8\"", "mypy (==v1.4.1) ; python_version == \"3.7\"", "myst-parser (==4.0.0) ; python_version >= \"3.11\"", "pre-commit (==4.0.1) ; python_version >= \"3.9\"", "pytest (==6.1.2) ; python_version < \"3.8\"", "pytest (==8.3.2) ; python_version >= \"3.8\"", "pytest-cov (==2.12.1) ; python_version < \"3.8\"", "pytest-cov (==5.0.0) ; python_version == \"3.8\"", "pytest-cov (==6.0.0) ; python_version >= \"3.9\"", "pytest-mypy-plugins (==1.9.3) ; python_version >= \"3.6\" and python_version < \"3.8\"", "pytest-mypy-plugins (==3.1.0) ; python_version >= \"3.8\"", "sphinx-rtd-theme (==3.0.2) ; python_version >= \"3.11\"", "tox (==3.27.1) ; python_version < \"3.8\"", "tox (==4.23.2) ; python_version >= \"3.8\"", "twine (==6.0.1) ; python_version >= \"3.11\""] +dev = ["Sphinx (==8.1.3) ; python_version >= \"3.11\"", "build (==1.2.2) ; python_version >= \"3.11\"", "colorama (==0.4.5) ; python_version < \"3.8\"", "colorama (==0.4.6) ; python_version >= \"3.8\"", "exceptiongroup (==1.1.3) ; python_version >= \"3.7\" and python_version < \"3.11\"", "freezegun (==1.1.0) ; python_version < \"3.8\"", "freezegun (==1.5.0) ; python_version >= \"3.8\"", "mypy (==0.910) ; python_version < \"3.6\"", "mypy (==0.971) ; python_version == \"3.6\"", "mypy (==1.13.0) ; python_version >= \"3.8\"", "mypy (==1.4.1) ; python_version == \"3.7\"", "myst-parser (==4.0.0) ; python_version >= \"3.11\"", "pre-commit (==4.0.1) ; python_version >= \"3.9\"", "pytest (==6.1.2) ; python_version < \"3.8\"", "pytest (==8.3.2) ; python_version >= \"3.8\"", "pytest-cov (==2.12.1) ; python_version < \"3.8\"", "pytest-cov (==5.0.0) ; python_version == \"3.8\"", "pytest-cov (==6.0.0) ; python_version >= \"3.9\"", "pytest-mypy-plugins (==1.9.3) ; python_version >= \"3.6\" and python_version < \"3.8\"", "pytest-mypy-plugins (==3.1.0) ; python_version >= \"3.8\"", "sphinx-rtd-theme (==3.0.2) ; python_version >= \"3.11\"", "tox (==3.27.1) ; python_version < \"3.8\"", "tox (==4.23.2) ; python_version >= \"3.8\"", "twine (==6.0.1) ; python_version >= \"3.11\""] [[package]] name = "lxml" @@ -1879,6 +1886,7 @@ description = "A Python package for easy multiprocessing, but faster than multip optional = false python-versions = "*" groups = ["main"] +markers = "python_version < \"3.13\"" files = [ {file = "mpire-2.10.2-py3-none-any.whl", hash = "sha256:d627707f7a8d02aa4c7f7d59de399dec5290945ddf7fbd36cbb1d6ebb37a51fb"}, {file = "mpire-2.10.2.tar.gz", hash = "sha256:f66a321e93fadff34585a4bfa05e95bd946cf714b442f51c529038eb45773d97"}, @@ -2605,6 +2613,7 @@ description = "JSON5 serializer and parser for Python 3 written in Cython." optional = false python-versions = "~=3.7" groups = ["main"] +markers = "python_version < \"3.13\"" files = [ {file = "pyjson5-1.6.9-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:bd84d94e8422e14292f1acc8edcc7deaee313eb7475c113ba77a16c0ac384160"}, {file = "pyjson5-1.6.9-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:f4a3215d5ecab101e0e9752d4aec6935ab45a82f6f0282283307bbab495c9677"}, @@ -3021,7 +3030,7 @@ description = "Python for Window Extensions" optional = false python-versions = "*" groups = ["main"] -markers = "platform_system == \"Windows\"" +markers = "python_version < \"3.13\" and platform_system == \"Windows\"" files = [ {file = "pywin32-310-cp310-cp310-win32.whl", hash = "sha256:6dd97011efc8bf51d6793a82292419eba2c71cf8e7250cfac03bba284454abc1"}, {file = "pywin32-310-cp310-cp310-win_amd64.whl", hash = "sha256:c3e78706e4229b915a0821941a84e7ef420bf2b77e08c9dae3c76fd03fd2ae3d"}, @@ -4144,6 +4153,7 @@ description = "Fast, Extensible Progress Meter" optional = false python-versions = ">=3.7" groups = ["main"] +markers = "python_version < \"3.13\"" files = [ {file = "tqdm-4.67.1-py3-none-any.whl", hash = "sha256:26445eca388f82e72884e0d580d5464cd801a3ea01e63e5601bdff9ba6a48de2"}, {file = "tqdm-4.67.1.tar.gz", hash = "sha256:f8aef9c52c08c13a65f30ea34f4e5aac3fd1a34959879d7e59e63027286627f2"}, @@ -4380,5 +4390,5 @@ files = [ [metadata] lock-version = "2.1" -python-versions = ">=3.10,<3.12" -content-hash = "f77b12617f62cdc5cd99232e73fe70120ee78fe2fcb89a563eff5f94029a0f30" +python-versions = ">=3.10,<3.14" +content-hash = "079385645398bcbde8692a8cb4a85eef36fe48df43c94b5f1c5f056bf9a1aa9a" diff --git a/pypeline.yaml b/pypeline.yaml index 1db7961..9cdfc51 100644 --- a/pypeline.yaml +++ b/pypeline.yaml @@ -4,7 +4,7 @@ pipeline: module: pypeline.steps.create_venv config: bootstrap_script: .bootstrap/bootstrap.py - python_executable: python311 + python_executable: python3 - step: ScoopInstall module: pypeline.steps.scoop_install build: diff --git a/pyproject.toml b/pyproject.toml index 97f482b..af40c5f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,14 +24,14 @@ please = "spl_core.main:main" "Changelog" = "https://github.com/avengineers/spl-core/blob/develop/CHANGELOG.md" [tool.poetry.dependencies] -python = ">=3.10,<3.12" +python = ">=3.10,<3.14" py-app-dev = "^2.1" cookiecutter = "==2.6.0" gcovr = "^8.3" -hammocking = ">=0.8,<0.10" +hammocking = { git = "https://github.com/useblocks/hammocking.git" } kconfiglib = "^14.1" typer = "^0" -doxysphinx = "^3.3" +doxysphinx = { version = "^3.3", python = "<3.13" } sphinx = "^7.3" sphinx-rtd-theme = "^2.0" sphinxcontrib-mermaid = "^0.9" From 08394523609f089edc38b75a8c291d5eb13ebe77 Mon Sep 17 00:00:00 2001 From: Daniel Woste Date: Mon, 23 Feb 2026 11:20:08 +0100 Subject: [PATCH 2/2] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index fe34bbf..8058ac8 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ + A quick test... + # SPL (Software Product Line) Core