-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathMakefile
100 lines (94 loc) · 3.74 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
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
.PHONY:
help
buildclean
pylintclean
compileclean
docclean
clean
pylint
pylint-reports
pyreverse
pyreverse-mod
dependencies
build
install
build-dev
dependencies-dev
install-dev
dependencies-doc
build-doc
# Help: display the main commands
help:
@echo "Makefile for fragscapy. Most used commands:"
@echo " make install install Fragscapy"
@echo " make install-dev install Fragscapy in dev mode"
@echo " make build-doc build the documentation"
@echo " make clean cleanup the non-necessary files"
@echo " make pylint evluate the code quality with pylint"
@echo " make pylint-reports show the pylint reports"
@echo " make pyreverse generate UML diagram of code without the mods"
@echo " make pyreverse-mod generate UML diagram of code with the mods"
# Clean commands: clean different kind of files each
buildclean:
@echo "Deleting build files"
@rm -Rf build
@rm -Rf dist
@rm -Rf fragscapy.egg-info
pylintclean:
@echo "Deleting pylint files"
@find . -type d -path './fragscapy*/__pycache__' -exec rm -Rf {} +
@rm -f classes_fragscapy.dot packages_fragscapy.dot classes_fragscapy.svg packages_fragscapy.svg
compileclean:
@echo "Deleting compiled files"
@find . -type f -path './fragscapy/*.py[co]' -delete
docclean:
@echo "Deleting documentation"
@rm -rf docs/_build
@find docs/source/ -not -path 'docs/source/' -not -path 'docs/source/_templates' -not -path 'docs/source/_templates/.placeholder' -not -path 'docs/source/index.rst' -not -path 'docs/source/conf.py' -not -path 'docs/source/_static' -not -path 'docs/source/_static/.placeholder' -print0 | xargs -0 rm -f --
clean: buildclean pylintclean compileclean docclean
# Pylint-related commands
pylint:
@if ! command -v pylint > /dev/null; then echo "Pylint not found, run 'make dependencies-dev'."; exit 1; fi
@pylint fragscapy; exit 0
pylint-reports:
@if ! command -v pylint > /dev/null; then echo "Pylint not found, run 'make dependencies-dev'."; exit 1; fi
@pylint fragscapy --reports=y; exit 0
pyreverse:
@if ! command -v pyreverse > /dev/null; then echo "Pyreverse not found, run 'make dependencies-dev'."; exit 1; fi
@if ! command -v dot > /dev/null; then echo "dot not found, install 'graphviz'"; exit 1; fi
@find fragscapy/ -type f -not -path 'fragscapy/modifications/*' | xargs pyreverse -p fragscapy -- fragscapy/modifications/__init__.py fragscapy/modifications/mod.py fragscapy/modifications/utils.py
@dot -Tsvg classes_fragscapy.dot > classes_fragscapy.svg
@dot -Tsvg packages_fragscapy.dot > packages_fragscapy.svg
@echo "Generated files 'classes_fragscapy.svg' and 'packages_fragscapy.svg'"
pyreverse-mod:
@if ! command -v pyreverse > /dev/null; then echo "Pyreverse not found, run 'make dependencies-dev'."; exit 1; fi
@if ! command -v dot > /dev/null; then echo "dot not found, install 'graphviz'"; exit 1; fi
@pyreverse -p fragscapy fragscapy/
@dot -Tsvg classes_fragscapy.dot > classes_fragscapy.svg
@dot -Tsvg packages_fragscapy.dot > packages_fragscapy.svg
@echo "Generated files 'classes_fragscapy.svg' and 'packages_fragscapy.svg'"
# Standard install
dependencies:
pip3 install wheel
pip3 install -r requirements.txt
build: buildclean dependencies
./setup.py sdist bdist_wheel
install: build
./setup.py install
# Development install
dependencies-dev: dependencies
pip3 install wheel
pip3 install -r requirements-dev.txt
build-dev: buildclean dependencies-dev
./setup.py sdist bdist_wheel
install-dev: build-dev
./setup.py develop --uninstall
./setup.py develop
# Documentation building
dependencies-doc: dependencies
pip3 install wheel
pip3 install -r requirements-doc.txt
build-doc: dependencies-doc docclean
mkdir docs/_build
sphinx-apidoc -f -o docs/source fragscapy --separate
sphinx-build -b html docs/source docs/_build