#!/bin/bash

PYTHON_VERSION=${PYTHON_VERSION:-2}
CR="
"
vmtests=""
if [ "$PYTHON_VERSION" = "3" ]; then
    vmtests="tests/vmtests/"
fi
pycheck_dirs=( "curtin/" "tests/unittests/" $vmtests )

set -f
if [ $# -eq 0 ]; then
   files=( "${pycheck_dirs[@]}" )
else
   files=( "$@" )
fi

cmd=( "python${PYTHON_VERSION}" -m "pyflakes" "${files[@]}" )

echo "Running: " "${cmd[@]}" 1>&2
exec "${cmd[@]}"
