Blame SOURCES/pythondeps.sh

f2ca21
#!/bin/bash
f2ca21
f2ca21
[ $# -ge 1 ] || {
f2ca21
    cat > /dev/null
f2ca21
    exit 0
f2ca21
}
f2ca21
f2ca21
case $1 in
f2ca21
-P|--provides)
f2ca21
    shift
f2ca21
    # Match buildroot/payload paths of the form
f2ca21
    #    /PATH/OF/BUILDROOT/usr/bin/pythonMAJOR.MINOR
f2ca21
    # generating a line of the form
f2ca21
    #    python(abi) = MAJOR.MINOR
f2ca21
    # (Don't match against -config tools e.g. /usr/bin/python2.6-config)
f2ca21
    grep "/usr/bin/python.\..$" \
f2ca21
        | sed -e "s|.*/usr/bin/python\(.\..\)|python(abi) = \1|"
f2ca21
    ;;
f2ca21
-R|--requires)
f2ca21
    shift
f2ca21
    # Match buildroot paths of the form
f2ca21
    #    /PATH/OF/BUILDROOT/usr/lib/pythonMAJOR.MINOR/  and
f2ca21
    #    /PATH/OF/BUILDROOT/usr/lib64/pythonMAJOR.MINOR/
f2ca21
    # generating (uniqely) lines of the form:
f2ca21
    #    python(abi) = MAJOR.MINOR
afc3d2
    grep -E "/usr/lib[^/]*/python[[:digit:]]+\.[[:digit:]]+/.*" \
afc3d2
        | sed -Ee "s|.*/usr/lib[^/]*/python([[:digit:]]+\.[[:digit:]]+)/.*|python(abi) = \1|g" \
f2ca21
        | sort | uniq
f2ca21
    ;;
f2ca21
esac
f2ca21
f2ca21
exit 0