-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
93 lines (71 loc) · 2.86 KB
/
Makefile
File metadata and controls
93 lines (71 loc) · 2.86 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
82
83
84
85
86
87
88
89
90
91
92
93
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2023-2024, Cyrille Favreau ([email protected])
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
#see if we're in a virtualenv, and use that, otherwise use the default
ifdef VIRTUAL_ENV
VENV=$(VIRTUAL_ENV)
else
VENV:=venv
endif
VENV_BIN:=$(VENV)/bin
# simulate running in headless mode
unexport DISPLAY
# Test coverage pass threshold (percent)
MIN_COV?=45
VENV_INSTALLED=.installed
PIP_INSTALL_OPTIONS=--ignore-installed --no-deps
FIND_LINT_PY=`find nuon_model_visualizer -name "*.py" -not -path "*/*test*"`
LINT_PYFILES := $(shell find $(FIND_LINT_PY))
$(VENV):
virtualenv --system-site-packages $(VENV)
$(VENV_INSTALLED): $(VENV)
$(VENV_BIN)/pip install $(PIP_INSTALL_OPTIONS) -r requirements_dev.txt
$(VENV_BIN)/pip install -e .
touch $@
run_pycodestyle: $(VENV_INSTALLED)
$(VENV_BIN)/pycodestyle $(LINT_PYFILES) > pycodestyle.txt
run_pydocstyle: $(VENV_INSTALLED)
$(VENV_BIN)/pydocstyle $(LINT_PYFILES) > pydocstyle.txt
run_pylint: $(VENV_INSTALLED)
$(VENV_BIN)/pylint --rcfile=pylintrc $(LINT_PYFILES) > pylint.txt
run_tests: $(VENV_INSTALLED)
$(VENV_BIN)/nosetests -v --with-coverage --cover-min-percentage=$(MIN_COV) --cover-erase --cover-package nuon_model_visualizer
run_tests_xunit: $(VENV_INSTALLED)
@mkdir -p $(ROOT_DIR)/test-reports
$(VENV_BIN)/nosetests nuon_model_visualizer --with-coverage --cover-min-percentage=$(MIN_COV) --cover-inclusive --cover-erase --cover-package=nuon_model_visualizer --with-xunit --xunit-file=nosetests_nuon_model_visualizer.xml
lint: run_pycodestyle run_pydocstyle run_pylint
test: lint run_tests
doc: $(VENV_INSTALLED)
make SPHINXBUILD=$(VENV_BIN)/sphinx-build -C doc html
doc_pdf: $(VENV_INSTALLED)
make SPHINXBUILD=$(VENV_BIN)/sphinx-build -C doc latexpdf
clean_test_venv:
@rm -rf $(VENV_INSTALLED)
@rm -rf $(ROOT_DIR)/test-reports
clean_doc:
@test -x $(VENV_BIN)/sphinx-build && make SPHINXBUILD=$(VENV_BIN)/sphinx-build -C doc clean || true
@rm -rf $(ROOT_DIR)/doc/build
clean: clean_doc clean_test_venv
@rm -f pycodestyle.txt
@rm -f pydocstyle.txt
@rm -f pylint.txt
@rm -rf nuon_model_visualizer/nuon_model_visualizer.egg-info
@rm -f .coverage
@rm -rf test-reports
@rm -rf dist
@rm -f $(VENV_INSTALLED)
.PHONY: run_pycodestyle test clean_test_venv clean doc