This repository has been archived by the owner on Nov 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
72 lines (60 loc) · 2.45 KB
/
Makefile
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
# Copyright 2019 Felix Soubelet <felix.soubelet@cern.ch>
# MIT License
# Documentation for most of what you will see here can be found at the following links:
# for the GNU make special targets: https://www.gnu.org/software/make/manual/html_node/Special-Targets.html
# for python packaging: https://docs.python.org/3/distutils/introduction.html
# ANSI escape sequences for bold, cyan, dark blue, end, pink and red.
B = \033[1m
C = \033[96m
D = \033[34m
E = \033[0m
P = \033[95m
R = \033[31m
.PHONY : help clean format install lines lint tests type
all: install
help:
@echo "Please use 'make $(R)<target>$(E)' where $(R)<target>$(E) is one of:"
@echo " $(R) build $(E) \t to build wheel and source distribution with $(P)Hatch$(E)."
@echo " $(R) clean $(E) \t to recursively remove build, run and bitecode files/dirs."
@echo " $(R) format $(E) \t to check and format code with $(P)Ruff$(E) through $(P)Hatch$(E)."
@echo " $(R) install $(E) \t to $(C)pip install$(E) this package into the current environment."
@echo " $(R) lint $(E) \t to lint-check the code with $(P)Ruff$(E)."
@echo " $(R) tests $(E) \t to run tests with the $(P)pytest$(E) package."
build:
@echo "Re-building wheel and dist"
@rm -rf dist
@hatch build --clean
@echo "Created build is located in the $(C)dist$(E) folder."
clean:
@echo "Cleaning up distutils remains."
@rm -rf build
@rm -rf dist
@rm -rf aoe2netwrapper.egg-info
@rm -rf .eggs
@echo "Cleaning up bitecode files and python cache."
@find . -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -delete
@echo "Cleaning up pytest cache."
@find . -type d -name '*.pytest_cache' -exec rm -rf {} + -o -type f -name '*.pytest_cache' -exec rm -rf {} +
@echo "Cleaning up mypy cache."
@find . -type d -name "*.mypy_cache" -exec rm -rf {} +
@echo "Cleaning up coverage reports."
@find . -type f -name '.coverage' -exec rm -rf {} + -o -type f -name 'coverage.xml' -delete
@echo "All cleaned up!\n"
format:
@echo "Checking code with Ruff through Hatch."
@hatch fmt
install: format clean
@echo "Installing (editable) with $(D)pip$(E) in the current environment."
@python -m pip install --editable . -v
lint:
@echo "Checking code with Ruff through Hatch."
@hatch fmt
tests: clean
@python -m pytest
@make clean
# Catch-all unknow targets without returning an error. This is a POSIX-compliant syntax.
.DEFAULT:
@echo "Make caught an invalid target."
@echo "See help output below for available targets."
@echo ""
@make help