Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
123 lines (111 loc) · 4.48 KB
/
Copy pathMakefile
File metadata and controls
123 lines (111 loc) · 4.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
SHELL := /bin/zsh
# Colors
RED := \033[0;31m
GREEN := \033[0;32m
YELLOW := \033[0;33m
BLUE := \033[0;34m
PURPLE := \033[0;35m
YELLOW2 := \033[33;1m
CYAN := \033[0;36m
RESET := \033[0m
BOLD := \033[1m
VENV = venv
PYTHON := $(VENV)/bin/python3
PIP := $(VENV)/bin/pip
MAIN_SCRIPT := fly_in.py
CONFIG_DIR := maps
.PHONY: venv install run debug clean lint lint-strict help
.DEFAULT_GOAL := help
venv:
@echo "$(YELLOW)$(BOLD)Creating virtual environment...$(RESET)"
python3 -m venv $(VENV)
@echo "$(GREEN)✓ Virtual environment created!$(RESET)"
install: venv
@echo "$(YELLOW2)$(BOLD) Installing Fly-in dependencies...$(RESET)"
uv sync --all-groups
@echo "$(GREEN)$(BOLD)✓ Dependencies installed!$(RESET)"
run:
@printf "$(YELLOW)$(BOLD)Scanning directory: $(CONFIG_DIR)...$(RESET)\n"
@i=1; \
for file in $$(find $(CONFIG_DIR) -type f -name "*.txt" | sort); do \
printf "$$i) $$file\n"; \
eval "file_$$i=$$file"; \
i=$$((i+1)); \
done; \
count=$$((i-1)); \
if [ $$count -eq 0 ]; then \
printf "$(RED)❌ No files found.$(RESET)\n"; \
exit 1; \
fi; \
printf "$(YELLOW2)Choose your config: $(RESET)"; \
read selection; \
selected_file=$$(find $(CONFIG_DIR) -type f -name "*.txt" | sort | sed -n "$${selection}p"); \
if [ -n "$$selected_file" ]; then \
clear; \
printf "$(GREEN)$(BOLD)🚀 Launching Fly-in with: $$selected_file$(RESET)\n"; \
uv run python3 $(MAIN_SCRIPT) "$$selected_file" --visual; \
else \
printf "$(RED)❌ Invalid choice: $$selection$(RESET)\n"; \
fi
run-ez:
@printf "$(YELLOW)$(BOLD)Scanning directory: $(CONFIG_DIR)...$(RESET)\n"
@i=1; \
for file in $$(find $(CONFIG_DIR) -type f -name "*.txt" | sort); do \
printf "$$i) $$file\n"; \
eval "file_$$i=$$file"; \
i=$$((i+1)); \
done; \
count=$$((i-1)); \
if [ $$count -eq 0 ]; then \
printf "$(RED)❌ No files found.$(RESET)\n"; \
exit 1; \
fi; \
printf "$(YELLOW2)Choose your config: $(RESET)"; \
read selection; \
selected_file=$$(find $(CONFIG_DIR) -type f -name "*.txt" | sort | sed -n "$${selection}p"); \
if [ -n "$$selected_file" ]; then \
clear; \
printf "$(GREEN)$(BOLD)🚀 Launching Fly-in with: $$selected_file$(RESET)\n"; \
uv run python3 $(MAIN_SCRIPT) "$$selected_file";\
else \
printf "$(RED)❌ Invalid choice: $$selection$(RESET)\n"; \
fi
debug:
@echo "$(YELLOW)$(BOLD) Launching Fly-in in debug mode...$(RESET)"
$(PYTHON) -m pdb $(MAIN_SCRIPT) $(CONFIG_FILE)
clean:
@echo "$(YELLOW)$(BOLD) Cleaning temporary files and caches...$(RESET)"
@if [ -d "venv" ]; then rm -rf venv && echo "$(RED) ✓ Removed venv/$(RESET)"; fi
@rm -rf dist/ build/ 2>/dev/null || true
@find . -type d -name "__pycache__" -prune -exec rm -rf {} + 2>/dev/null || true
@find . -type d -name ".mypy_cache" -exec rm -rf {} + 2>/dev/null || true
@find . -type d -name ".pytest_cache" -exec rm -rf {} + 2>/dev/null || true
@find . -type f -name "*.pyc" -delete 2>/dev/null || true
@echo "$(GREEN)$(BOLD)✓ Cleanup complete!$(RESET)"
lint:
@echo "$(YELLOW)$(BOLD)🔎 Running flake8...$(RESET)"
uv run flake8
@echo "$(YELLOW2)$(BOLD)🔎 Running mypy...$(RESET)"
uv run mypy . --warn-return-any --warn-unused-ignores --ignore-missing-imports --disallow-untyped-defs --check-untyped-defs
@echo "$(GREEN)$(BOLD)✓ Lint complete!$(RESET)"
lint-strict:
@echo "$(YELLOW)$(BOLD)🔎 Running flake8 (strict)...$(RESET)"
uv run flake8
@echo "$(YELLOW2)$(BOLD)🔎 Running mypy (strict)...$(RESET)"
uv run mypy . --strict
@echo "$(GREEN)$(BOLD)✓ Strict lint complete!$(RESET)"
help:
@echo ""
@echo "$(YELLOW)$(BOLD) Fly-in — Drone Routing Simulation$(RESET)"
@echo "$(RED)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━$(RESET)"
@echo " $(YELLOW)make venv$(RESET) - Setup virtual environment"
@echo " $(YELLOW2)make install$(RESET) - Install project dependencies"
@echo " $(YELLOW)make run$(RESET) - Run the visual simulation"
@echo " $(YELLOW)make run-ez$(RESET) - Run the terminal simulation"
@echo " $(YELLOW2)make debug$(RESET) - Run in debug mode (pdb)"
@echo " $(YELLOW)make clean$(RESET) - Remove caches and temp files"
@echo " $(YELLOW2)make lint$(RESET) - Run flake8 + mypy"
@echo " $(YELLOW)make lint-strict$(RESET) - Run flake8 + mypy strict"
@echo " $(YELLOW2)make help$(RESET) - Show this message"
@echo "$(RED)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━$(RESET)"
@echo ""