Run mypy if it's available.

The Python tools pyliint, flake8, and mypy are only run if they exist in
$PATH.
This commit is contained in:
Jakob Stoklund Olesen
2016-10-26 12:26:23 -07:00
parent 7722ba91ff
commit 5dc9ea1de4

View File

@@ -2,11 +2,21 @@
set -e set -e
cd $(dirname "$0") cd $(dirname "$0")
# Run unit tests. echo "=== Python unit tests ==="
python -m unittest discover python -m unittest discover
runif() {
if command -v "$1" > /dev/null; then
echo "=== $1 ==="
"$@"
else
echo "$1 not found"
fi
}
# Check Python sources for Python 3 compatibility using pylint. # Check Python sources for Python 3 compatibility using pylint.
# #
# Install pylint with 'pip install pylint'. # Install pylint with 'pip install pylint'.
pylint --py3k --reports=no -- *.py cretonne isa runif pylint --py3k --reports=no -- *.py cretonne isa
flake8 . runif flake8 .
runif mypy --py2 build.py