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