2 # Copyright 2010-2014 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
5 # These are the versions we care about. The rest are just "nice to have".
6 PYTHON_SUPPORTED_VERSIONS="2.6 2.7 3.2 3.3"
7 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"
9 # has to be run from portage root dir
10 cd "${0%/*}" || exit 1
12 case "${NOCOLOR:-false}" in
26 echo "interrupted." >&2
30 trap interrupted SIGINT
33 IGNORE_MISSING_VERSIONS=true
35 while [ $# -gt 0 ] ; do
38 PYTHON_VERSIONS=${1#--python-versions=}
39 IGNORE_MISSING_VERSIONS=false
44 IGNORE_MISSING_VERSIONS=false
47 unused_args[${#unused_args[@]}]=$1
52 if [[ ${PYTHON_VERSIONS} == "supported" ]] ; then
53 PYTHON_VERSIONS=${PYTHON_SUPPORTED_VERSIONS}
56 set -- "${unused_args[@]}"
58 eprefix=${PORTAGE_OVERRIDE_EPREFIX}
62 for version in ${PYTHON_VERSIONS}; do
63 if [[ $version =~ ^([[:digit:]]+\.[[:digit:]]+)-pypy-([[:digit:]]+\.[[:digit:]]+)$ ]] ; then
64 executable=${eprefix}/usr/bin/pypy-c${BASH_REMATCH[2]}
66 executable=${eprefix}/usr/bin/python${version}
68 if [[ -x "${executable}" ]]; then
69 echo -e "${GOOD}Testing with Python ${version}...${NORMAL}"
70 "${executable}" -bb -Wd pym/portage/tests/runTests "$@"
72 status_array[${#status_array[@]}]=${status}
73 found_versions[${#found_versions[@]}]=${version}
74 if [ ${status} -ne 0 ] ; then
75 echo -e "${BAD}Testing with Python ${version} failed${NORMAL}"
79 elif [[ ${IGNORE_MISSING_VERSIONS} != "true" ]] ; then
80 echo -e "${BAD}Could not find requested Python ${version}${NORMAL}"
85 if [ ${#status_array[@]} -gt 0 ] ; then
87 for version in ${found_versions[@]} ; do
88 [ ${#version} -gt ${max_len} ] && max_len=${#version}
90 (( columns = max_len + 2 ))
91 (( columns >= 7 )) || columns=7
92 printf "\nSummary:\n\n"
93 printf "| %-${columns}s | %s\n|" "Version" "Status"
94 (( total_cols = columns + 11 ))
95 eval "printf -- '-%.0s' {1..${total_cols}}"
98 for version in ${found_versions[@]} ; do
99 if [ ${status_array[${row}]} -eq 0 ] ; then
104 printf "| %-${columns}s | %s\n" "${version}" "${status}"