-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
88 lines (68 loc) · 2.71 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
.PHONY: clean clean-test clean-pyc clean-build docs
docs:
cp README.rst docs/main.rst
sed -i '.bak' 's@docs/@@g' docs/main.rst
sphinx-apidoc -f -H PythiaPlotter -o docs/ pythiaplotter/
$(MAKE) -C docs clean
$(MAKE) -C docs html
@echo "HTML index: docs/_build/html/index.html"
freeze: ## freeze package requirements
pip freeze -l > requirements_new.txt
sed -i '.bak' '/.*PythiaPlotter.*/d' requirements_new.txt
rm requirements_new.txt.bak
flake: ## check style with flake8
flake8 --show-source --benchmark --exit-zero pythiaplotter
lint: ## check linting with pylint
pylint --rcfile=.pylintrc pythiaplotter
lint-py3: ## check py3 porting only, but not perfect
pylint --rcfile=.pylintrc --py3k pythiaplotter
examples: test ## update example outputs, but only if our tests are ok
@echo "Remaking examples..."
PythiaPlotter examples/example_pythia8.txt --inputFormat PYTHIA
PythiaPlotter examples/example_cmssw.txt --inputFormat CMSSW
PythiaPlotter examples/example_lhe.lhe --inputFormat LHE
PythiaPlotter examples/example_hepmc.hepmc --inputFormat HEPMC
test: ## run standard tests
python -m pytest -k "not test_examples_full" -r fEsp
tests: test ## cos I always forget singular or plural
test-examples: ## run full examples test
python -m pytest -r fEsp tests/test_examples_full.py
benchmark: ## run performance metrics
python tests/run_performance_metrics.py
cov: ## run coverage with all tests
coverage run -m pytest -r fEsp
coverage report
coverage html
@echo "Report in htmlcov/index.html"
clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts
clean-build: ## remove build artifacts
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +
clean-pyc: ## remove Python file artifacts
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +
clean-test: ## remove test and coverage artifacts
rm -fr .tox/
rm -f .coverage
rm -fr htmlcov/
installe: ## install the package as editable
pip install -e .
install: ## install the package properly
pip install .
uninstall:
pip uninstall -y PythiaPlotter
reinstall: uninstall clean install
@echo "Reinstalling PythiaPlotter"
reinstalle: uninstall clean installe
@echo "Reinstalling PythiaPlotter in editable mode"
## list all targets, taken from http://stackoverflow.com/a/26339924
.PHONY: list
list:
@echo "Available targets:"
@echo "=================="
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$'