build: Enhance venv-status to detect shell activation state

- Add venv-status target to check current shell activation
- Detect if venv exists but not activated vs actively running
- Handle different venv active vs project venv scenarios
- Use realpath for robust path comparison across symlinks
- Clean output with --no-print-directory flag
- Integrate status check into help target

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-09-22 00:18:24 +02:00
parent ad35e4f754
commit eab65c74b5

View File

@@ -1,17 +1,21 @@
# MarkiTect - Advanced Markdown Engine
# Makefile for common development tasks
.PHONY: help setup install test build clean update status dev lint format check-deps
.PHONY: help setup install test build clean update status dev lint format check-deps venv-status
# Default target
help:
@echo "MarkiTect Development Commands"
@echo "=============================="
@echo ""
@echo "Environment Status:"
@$(MAKE) --no-print-directory venv-status
@echo ""
@echo "Setup & Installation:"
@echo " setup - Initial project setup (venv + install)"
@echo " install - Install package in development mode"
@echo " dev - Install with development dependencies"
@echo " venv-status - Check if venv is active"
@echo ""
@echo "Development:"
@echo " test - Run all tests"
@@ -31,6 +35,23 @@ VENV := .venv
VENV_PYTHON := $(VENV)/bin/python
VENV_PIP := $(VENV)/bin/pip
# Check virtual environment status (read-only)
venv-status:
@if [ -f $(VENV)/bin/activate ] && [ -f $(VENV)/bin/python ]; then \
if [ -n "$$VIRTUAL_ENV" ] && [ "$$VIRTUAL_ENV" = "$$(realpath $(VENV))" ]; then \
echo " ✅ Virtual environment: Active in current shell"; \
elif [ -n "$$VIRTUAL_ENV" ]; then \
echo " ⚠️ Virtual environment: Different venv active ($$VIRTUAL_ENV)"; \
echo " Run 'deactivate' then 'source $(VENV)/bin/activate'"; \
else \
echo " 📁 Virtual environment: Ready but not activated"; \
echo " Run 'source $(VENV)/bin/activate' to activate"; \
fi; \
else \
echo " ❌ Virtual environment: Not found"; \
echo " Run 'make setup' to create and configure"; \
fi
# Setup virtual environment and install package
setup: $(VENV)/bin/activate install
@echo "✅ Project setup complete!"
@@ -133,4 +154,4 @@ check-deps: $(VENV)/bin/activate
$(VENV_PIP) list
@echo ""
@echo "Project dependencies:"
$(VENV_PIP) check
$(VENV_PIP) check