2 # Copyright 2010-2012 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
5 PYTHON_VERSIONS="2.6 2.7 2.7-pypy-1.8 2.7-pypy-1.9 2.7-pypy-2.0 3.1 3.2 3.3 3.4"
7 # has to be run from portage root dir
10 case "${NOCOLOR:-false}" in
24 echo "interrupted." >&2
28 trap interrupted SIGINT
32 while [ $# -gt 0 ] ; do
35 PYTHON_VERSIONS=${1#--python-versions=}
42 unused_args[${#unused_args[@]}]=$1
48 set -- "${unused_args[@]}"
50 eprefix=${PORTAGE_OVERRIDE_EPREFIX}
54 for version in ${PYTHON_VERSIONS}; do
55 if [[ $version =~ ^([[:digit:]]+\.[[:digit:]]+)-pypy-([[:digit:]]+\.[[:digit:]]+)$ ]] ; then
56 executable=${eprefix}/usr/bin/pypy-c${BASH_REMATCH[2]}
58 executable=${eprefix}/usr/bin/python${version}
60 if [[ -x "${executable}" ]]; then
61 echo -e "${GOOD}Testing with Python ${version}...${NORMAL}"
62 "${executable}" -Wd pym/portage/tests/runTests "$@"
64 status_array[${#status_array[@]}]=${status}
65 found_versions[${#found_versions[@]}]=${version}
66 if [ ${status} -ne 0 ] ; then
67 echo -e "${BAD}Testing with Python ${version} failed${NORMAL}"
74 if [ ${#status_array[@]} -gt 0 ] ; then
76 for version in ${found_versions[@]} ; do
77 [ ${#version} -gt ${max_len} ] && max_len=${#version}
79 (( columns = max_len + 2 ))
80 (( columns >= 7 )) || columns=7
81 printf "\nSummary:\n\n"
82 printf "| %-${columns}s | %s\n|" "Version" "Status"
83 (( total_cols = columns + 11 ))
84 eval "printf -- '-%.0s' {1..${total_cols}}"
87 for version in ${found_versions[@]} ; do
88 if [ ${status_array[${row}]} -eq 0 ] ; then
93 printf "| %-${columns}s | %s\n" "${version}" "${status}"