Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
81 lines (58 loc) · 1.53 KB
/
Copy pathMakefile
File metadata and controls
81 lines (58 loc) · 1.53 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
# ----------------- #
# Variables #
# ----------------- #
PYTHON=uv run python3
FLAKE8=uv run flake8
MYPY=uv run mypy
CHECK_UV=command -v uv
INSTALL_UV = curl -LsSf https://astral.sh/uv/install.sh | sh
MYPY_FLAGS=--warn-return-any --warn-unused-ignores --ignore-missing-imports \
--disallow-untyped-defs --check-untyped-defs \
# ----------------- #
# Rules #
# ----------------- #
.PHONY: all install run debug clean lint lint-strict
all: install run
install:
@clear
@if ! $(CHECK_UV) > /dev/null 2>&1; then \
echo "UV not installed. Installing..."; \
$(INSTALL_UV); \
fi
@echo "$(BROWN)Installing project dependencies using uv...$(END)"
uv sync --link-mode=copy
run:
@clear
@echo "$(BLUE)Running the project...$(END)"
$(PYTHON) pac-man.py config.json
debug:
@clear
@echo "$(BLUE)Running the project in debug...$(END)"
$(PYTHON) -m pdb pac-man.py config.json
clean:
@clear
@echo "$(RED)Removing unecessary files from the folder...$(END)"
find . -type d -name "__pycache__" -exec rm -rf {} +
find . -type d -name ".mypy_cache" -exec rm -rf {} +
find . -name "*.pyc" -delete
@echo "\n$(GREEN)Folder cleaned!$(END)"
lint:
@clear
@status=0; \
$(FLAKE8) . || status=$$?; \
$(MYPY) . $(MYPY_FLAGS) || status=$$?; \
exit $$status
lint-strict:
@clear
@status=0; \
$(FLAKE8) . || status=$$?; \
$(MYPY) . $(MYPY_FLAGS) --strict || status=$$?; \
exit $$status
# ----------------- #
# Colors #
# ----------------- #
BROWN=\033[1;33m
BLUE=\033[1;94m
RED=\033[1;31m
GREEN=\033[1;92m
END=\033[0m