|
1 | 1 | # NetGraph-Core Development Makefile |
2 | 2 |
|
3 | | -.PHONY: help venv clean-venv dev install check check-ci lint format test qt clean build info hooks cov cpp-test rebuild check-python |
| 3 | +.PHONY: help venv clean-venv dev install check check-ci lint format test qt clean build info hooks cov cpp-test rebuild check-python sanitize-test |
4 | 4 |
|
5 | 5 | .DEFAULT_GOAL := help |
6 | 6 |
|
@@ -48,8 +48,16 @@ DEV_ENV := $(ENV_MACOS) $(ENV_CC) $(ENV_CXX) $(ENV_CMAKE) |
48 | 48 | dev: |
49 | 49 | @echo "🚀 Setting up development environment..." |
50 | 50 | @if [ ! -x "$(VENV_BIN)/python" ]; then \ |
| 51 | + if [ -z "$(PY_FIND)" ]; then \ |
| 52 | + echo "❌ Error: No Python interpreter found (python3 or python)"; \ |
| 53 | + exit 1; \ |
| 54 | + fi; \ |
51 | 55 | echo "🐍 Creating virtual environment with $(PY_FIND) ..."; \ |
52 | | - $(PY_FIND) -m venv venv; \ |
| 56 | + $(PY_FIND) -m venv venv || { echo "❌ Failed to create venv"; exit 1; }; \ |
| 57 | + if [ ! -x "$(VENV_BIN)/python" ]; then \ |
| 58 | + echo "❌ Error: venv creation failed - $(VENV_BIN)/python not found"; \ |
| 59 | + exit 1; \ |
| 60 | + fi; \ |
53 | 61 | $(VENV_BIN)/python -m pip install -U pip wheel; \ |
54 | 62 | fi |
55 | 63 | @echo "📦 Installing dev dependencies..." |
|
61 | 69 |
|
62 | 70 | venv: |
63 | 71 | @echo "🐍 Creating virtual environment in ./venv ..." |
64 | | - @$(PY_FIND) -m venv venv |
| 72 | + @if [ -z "$(PY_FIND)" ]; then \ |
| 73 | + echo "❌ Error: No Python interpreter found (python3 or python)"; \ |
| 74 | + exit 1; \ |
| 75 | + fi |
| 76 | + @$(PY_FIND) -m venv venv || { echo "❌ Failed to create venv"; exit 1; } |
| 77 | + @if [ ! -x "$(VENV_BIN)/python" ]; then \ |
| 78 | + echo "❌ Error: venv creation failed - $(VENV_BIN)/python not found"; \ |
| 79 | + exit 1; \ |
| 80 | + fi |
65 | 81 | @$(VENV_BIN)/python -m pip install -U pip wheel |
66 | 82 | @echo "✅ venv ready. Activate with: source venv/bin/activate" |
67 | 83 |
|
@@ -94,16 +110,27 @@ test: |
94 | 110 | @$(PYTEST) |
95 | 111 |
|
96 | 112 | qt: |
97 | | - @$(PYTEST) -m "not slow and not benchmark" |
| 113 | + @$(PYTEST) --no-cov -m "not slow and not benchmark" |
98 | 114 |
|
99 | 115 | build: |
100 | | - @$(PYTHON) -m build |
| 116 | + @echo "🏗️ Building distribution packages..." |
| 117 | + @if $(PYTHON) -c "import build" >/dev/null 2>&1; then \ |
| 118 | + $(PYTHON) -m build; \ |
| 119 | + else \ |
| 120 | + echo "❌ build module not installed. Install dev dependencies with: make dev"; \ |
| 121 | + exit 1; \ |
| 122 | + fi |
101 | 123 |
|
102 | 124 | clean: |
103 | | - @rm -rf build/ dist/ *.egg-info/ **/__pycache__ */__pycache__ |
| 125 | + @echo "🧹 Cleaning build artifacts and cache files..." |
| 126 | + @rm -rf build/ dist/ *.egg-info/ |
| 127 | + @find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true |
| 128 | + @find . -type f -name "*.pyc" -delete 2>/dev/null || true |
| 129 | + @find . -type f -name "*.pyo" -delete 2>/dev/null || true |
104 | 130 | @rm -f .coverage coverage-*.xml coverage-*.html |
105 | 131 | @rm -rf htmlcov-python |
106 | 132 | @rm -rf Testing CTestTestfile.cmake |
| 133 | + @echo "✅ Cleanup complete!" |
107 | 134 |
|
108 | 135 | info: |
109 | 136 | @echo "Python (active): $$($(PYTHON) --version)" |
|
0 commit comments