Support multiple parallel python versions in pythondeps.sh

- dont make assumptions about /usr/bin/python, extract the ABI version
  from python libdir version
- patch from David Malcolm
This commit is contained in:
Panu Matilainen 2010-01-30 12:12:02 +02:00
parent 53e3f65b8e
commit 426a7b6f44
1 changed files with 15 additions and 5 deletions

View File

@ -5,17 +5,27 @@
exit 0
}
PYVER=`python -c "import sys; v=sys.version_info[:2]; print '%d.%d'%v"`
case $1 in
-P|--provides)
shift
grep "/usr/bin/python\*\$" >& /dev/null && echo "python(abi) = ${PYVER}"
exit 0
# Match buildroot/payload paths of the form
# /PATH/OF/BUILDROOT/usr/bin/pythonMAJOR.MINOR
# generating a line of the form
# python(abi) = MAJOR.MINOR
# (Don't match against -config tools e.g. /usr/bin/python2.6-config)
grep "/usr/bin/python.\..$" \
| sed -e "s|.*/usr/bin/python\(.\..\)|python(abi) = \1|"
;;
-R|--requires)
shift
grep "/usr/lib[^/]*/python${PYVER}/" >& /dev/null && echo "python(abi) = ${PYVER}"
exit 0
# Match buildroot paths of the form
# /PATH/OF/BUILDROOT/usr/lib/pythonMAJOR.MINOR/ and
# /PATH/OF/BUILDROOT/usr/lib64/pythonMAJOR.MINOR/
# generating (uniqely) lines of the form:
# python(abi) = MAJOR.MINOR
grep "/usr/lib[^/]*/python.\../*" \
| sed -e "s|.*/usr/lib[^/]*/python\(.\..\)/.*|python(abi) = \1|g" \
| sort | uniq
;;
esac