Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/tests/test_pylint.sh
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2018-02-17 14:02:27 +0100
committerArthur de Jong <arthur@arthurdejong.org>2018-02-17 14:04:45 +0100
commite8a4705337613bd6400700e7f43bccca04e5587f (patch)
tree1095f5d47850f5bf6844899ed93f77ddc721ddfa /tests/test_pylint.sh
parent9a5097110da43c52236a39e2897940b86b5575e9 (diff)
Fix running pylint on distcheck
This sets PYTHONPATH so that both the source and build directories are used to find constants.py.
Diffstat (limited to 'tests/test_pylint.sh')
-rwxr-xr-xtests/test_pylint.sh13
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/test_pylint.sh b/tests/test_pylint.sh
index 0ba2f83..b97600a 100755
--- a/tests/test_pylint.sh
+++ b/tests/test_pylint.sh
@@ -24,6 +24,8 @@ set -e
# find source directory
srcdir="${srcdir-`dirname "$0"`}"
top_srcdir="${top_srcdir-${srcdir}/..}"
+builddir="${builddir-`dirname "$0"`}"
+top_builddir="${top_builddir-${builddir}/..}"
# if Pylint is missing, ignore
if ! pylint --version > /dev/null 2> /dev/null
@@ -41,10 +43,13 @@ rcfile="$absdir/pylint.rc"
disable=$(sed -n 's/^disable=\(.*\)$/\1/p' "$rcfile")
# run Pylint in both pynslcd and utils directories
-( cd "$top_srcdir/pynslcd" ;
- pylint --errors-only --rcfile "$rcfile" --disable "$disable" *.py)
-( cd "$top_srcdir/utils" ;
- pylint --errors-only --rcfile "$rcfile" --disable "$disable" *.py)
+for dir in pynslcd utils
+do
+ echo "Running pylint in $dir..."
+ dir_builddir="$(cd "${top_builddir}/${dir}" && pwd)"
+ ( cd "${top_srcdir}/${dir}" ;
+ PYTHONPATH="${dir_builddir}" pylint --errors-only --rcfile "$rcfile" --disable "$disable" *.py)
+done
# Pylint has the following exit codes:
# 0 if everything went fine