-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
145 lines (123 loc) · 4.83 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
### * Variables
PYTHON_MODULE=pydep
PYTHON_MODULE_EGG=$(PYTHON_MODULE).egg-info
COVERED_PACKAGES=$(PYTHON_MODULE)
SPHINX_DOC_FOLDER=docs/
# ### ** Main script
# PYTHON=python
# MODULE_NAME=pydep
# MYSCRIPT_NOPY=pydep
# MYSCRIPT=$(MODULE_NAME)/$(MYSCRIPT_NOPY).py
# ### ** Tests
# TEST_DIR=tests
# TEST_SCRIPT=tests.py
# ### ** Examples
# EXAMPLE_MOD_NOPY=exampleModule
### * Help
Help:
@echo "Makefile for the $(PYTHON_MODULE) Python module "
@echo " "
@echo "Type: \"make <target>\" where <target> is one of the following: "
@echo " "
@echo " test Run the tests with coverage output "
@echo " doc Run Sphinx to make the docs "
@echo " clean Remove generated doc, tests and pyc files "
@echo " "
@echo "You need sudo rights for the following ones: "
@echo " "
@echo " install Install the module and command-line tools "
@echo " uninstall Uninstall the module "
# @echo " examples Run basic examples "
# @echo " doc_examples Run doc examples "
# @echo " test Run tests "
# @echo ""
# @echo " install Run pip install -e (must be sudo) "
# @echo " uninstall Remove the package (must be sudo) "
# @echo ""
# @echo " clean Clean everything except the egg info "
# @echo " clean_egg Clean egg info folder (must be sudo) "
# @echo " doc_clean Clean doc examples "
### * Main targets
### ** test
tests: test
test:
nosetests tests/ --with-coverage --cover-package=$(COVERED_PACKAGES) --cover-html \
--with-html --html-file=tests/nosetests.html
@echo -e "\nThe coverage results are accessible from cover/index.html"
@echo "The html version of the test results are accessible from tests/nosetests.html"
### ** doc
docs: doc
doc:
sphinx-apidoc -o $(SPHINX_DOC_FOLDER) ./ setup.py
cd $(SPHINX_DOC_FOLDER); make html
@echo -e "\nThe documentation is accessible from $(SPHINX_DOC_FOLDER)_build/html/index.html"
### ** clean
clean:
rm -f .coverage
rm -fr cover
rm -f tests/nosetests.html
rm -fr docs/_build
find . -name \*.pyc -type f -delete
### ** install
install:
rm -fr $(PYTHON_MODULE_EGG)
pip install -e .
### ** uninstall
uninstall:
pip uninstall -y $(PYTHON_MODULE)
# ### ** examples
# examples:
# # Local graph of the pydep module
# $(PYTHON) $(MYSCRIPT) $(MYSCRIPT)
# dot -Tpdf $(MYSCRIPT_NOPY).graph.dot -o $(MYSCRIPT_NOPY).local.graph.pdf
# # Global graph of the pydep module
# $(PYTHON) $(MYSCRIPT) $(MYSCRIPT) --all
# dot -Tpdf $(MYSCRIPT_NOPY).graph.dot -o $(MYSCRIPT_NOPY).global.graph.pdf
# # Local graph of simple example module
# $(PYTHON) $(MYSCRIPT) $(TEST_DIR)/$(EXAMPLE_MOD_NOPY).py
# dot -Tpdf $(EXAMPLE_MOD_NOPY).graph.dot -o $(EXAMPLE_MOD_NOPY).graph.pdf
# ### ** doc_examples
# doc_examples: doc_clean
# # Local graph of the pydep module
# $(PYTHON) $(MYSCRIPT) $(MYSCRIPT)
# dot -Tpng $(MYSCRIPT_NOPY).graph.dot -o $(MYSCRIPT_NOPY).local.graph.png
# mv $(MYSCRIPT_NOPY).graph.dot doc_examples/$(MYSCRIPT_NOPY).local.graph.dot
# # Global graph of the pydep module
# $(PYTHON) $(MYSCRIPT) $(MYSCRIPT) --all
# dot -Tpng $(MYSCRIPT_NOPY).graph.dot -o $(MYSCRIPT_NOPY).global.graph.png
# mv $(MYSCRIPT_NOPY).graph.dot doc_examples/$(MYSCRIPT_NOPY).global.graph.dot
# # Local graph of simple example module
# $(PYTHON) $(MYSCRIPT) $(TEST_DIR)/$(EXAMPLE_MOD_NOPY).py
# dot -Tpng $(EXAMPLE_MOD_NOPY).graph.dot -o $(EXAMPLE_MOD_NOPY).graph.png
# mv $(EXAMPLE_MOD_NOPY).graph.dot doc_examples/
# # Move the output to doc_examples
# mv $(MYSCRIPT_NOPY).local.graph.png $(MYSCRIPT_NOPY).global.graph.png \
# $(EXAMPLE_MOD_NOPY).graph.png doc_examples/
# ### ** test
# test:
# nosetests $(TEST_SCRIPT) --with-coverage --cover-package=$(MYSCRIPT_NOPY) --cover-html
# @echo -e "\nThe coverage results are accessible from cover/index.html"
# tests: test
# ### ** install
# install:
# pip install -e .
# ### ** uninstall
# uninstall:
# pip uninstall -y $(MODULE_NAME)
# ### ** clean
# clean: doc_clean
# # pyc files
# rm -f *.pyc tests/*.pyc pydep/*.pyc
# # Coverage files
# rm -f .coverage
# rm -fr cover
# # Example files
# rm -f $(MYSCRIPT_NOPY).graph.dot
# rm -f $(MYSCRIPT_NOPY).local.graph.pdf
# rm -f $(MYSCRIPT_NOPY).global.graph.pdf
# rm -f $(EXAMPLE_MOD_NOPY).graph.dot
# rm -f $(EXAMPLE_MOD_NOPY).graph.pdf
# clean_egg:
# rm -fr $(MODULE_NAME).egg-info
# doc_clean:
# rm -f doc_examples/*