This repository has been archived by the owner on Jun 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
68 lines (51 loc) · 2.19 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
PYTHON3 = python3
SOURCEDIR = netsquid_pingpong
TESTDIR = tests
EXAMPLES = examples
RUNEXAMPLES = ${EXAMPLES}/run_examples.py
PIP_FLAGS = --extra-index-url=https://${NETSQUIDPYPI_USER}:${NETSQUIDPYPI_PWD}@pypi.netsquid.org
MINCOV = 0
help:
@echo "install Installs the package (editable)."
@echo "verify Verifies the installation, runs the linter and tests."
@echo "tests Runs the tests."
@echo "examples Runs the examples and makes sure they work."
@echo "open-cov-report Creates and opens the coverage report."
@echo "lint Runs the linter."
@echo "deploy-bdist Builds and uploads the package to the netsquid pypi server."
@echo "bdist Builds the package."
@echo "test-deps Installs the requirements needed for running tests and linter."
@echo "python-deps Installs the requirements needed for using the package."
@echo "docs Creates the html documentation"
@echo "clean Removes all .pyc files."
test-deps:
@$(PYTHON3) -m pip install -r test_requirements.txt
requirements python-deps: _check_pip
@$(PYTHON3) -m pip install -r requirements.txt ${PIP_FLAGS}
clean:
@/usr/bin/find . -name '*.pyc' -delete
lint:
@$(PYTHON3) -m flake8 ${SOURCEDIR} ${TESTDIR} ${EXAMPLEDIR}
tests:
@$(PYTHON3) -m pytest --cov=${SOURCEDIR} --cov-fail-under=${MINCOV} tests
open-cov-report:
@$(PYTHON3) -m pytest --cov=${SOURCEDIR} --cov-report html tests && open htmlcov/index.html
examples:
@${PYTHON3} ${RUNEXAMPLES} > /dev/null && echo "Examples OK!" || echo "Examples failed!"
docs html:
@${MAKE} -C docs html
bdist:
@$(PYTHON3) setup.py bdist_wheel
install: _check_pip test-deps
@$(PYTHON3) -m pip install -e . ${PIP_FLAGS}
_check_pip:
@echo "*** Checking the correct version of pip is installed."
@$(PYTHON3) -m pip install "pip>=19.0"
_clean_dist:
@/bin/rm -rf dist
deploy-bdist: _clean_dist bdist
@$(PYTHON3) setup.py deploy
verify: clean test-deps python-deps lint tests examples _verified
_verified:
@echo "The snippet is verified :)"
.PHONY: clean lint test-deps python-deps tests verify bdist deploy-bdist _clean_dist install open-cov-report examples _check_variables docs