Blame SOURCES/pythondeps-scl.sh

23b3e9
#!/bin/bash
23b3e9
# Altered from pythondeps.sh
23b3e9
# The second parameter is %{scl_prefix}, which is used to prefix python(abi).
23b3e9
23b3e9
[ $# -ge 1 ] || {
23b3e9
    cat > /dev/null
23b3e9
    exit 0
23b3e9
}
23b3e9
23b3e9
case $1 in
23b3e9
-P|--provides)
23b3e9
    shift
23b3e9
    # Match buildroot/payload paths of the form
23b3e9
    #    /PATH/OF/BUILDROOT/%{_scl_root}/usr/bin/pythonMAJOR.MINOR
23b3e9
    # generating a line of the form
23b3e9
    #    %{scl_prefix}python(abi) = MAJOR.MINOR
23b3e9
    # (Don't match against -config tools e.g. /usr/bin/python2.6-config)
23b3e9
    if [ "x$1" = "x" ]; then
23b3e9
        grep "/usr/bin/python.\..$" \
23b3e9
            | sed -e "s|.*/usr/bin/python\(.\..\)|python(abi) = \1|"
23b3e9
    else
23b3e9
        grep "/opt/.*/usr/bin/python.\..$" \
23b3e9
            | sed -e "s|.*/usr/bin/python\(.\..\)|$1python(abi) = \1|"
23b3e9
    fi
23b3e9
    ;;
23b3e9
-R|--requires)
23b3e9
    shift
23b3e9
    # Match buildroot paths of the form
23b3e9
    #    /PATH/OF/BUILDROOT/%{scl_root}/usr/lib/pythonMAJOR.MINOR/  and
23b3e9
    #    /PATH/OF/BUILDROOT/%{scl_root}/usr/lib64/pythonMAJOR.MINOR/
23b3e9
    # generating (uniqely) lines of the form:
23b3e9
    #    %{scl_prefix}python(abi) = MAJOR.MINOR
23b3e9
    if [ "x$1" = "x" ]; then
23b3e9
        grep "/usr/lib[^/]*/python.\../.*" \
23b3e9
            | sed -e "s|.*/usr/lib[^/]*/python\(.\..\)/.*|python(abi) = \1|g" \
23b3e9
            | sort | uniq
23b3e9
    else
23b3e9
        grep "/opt/.*/usr/lib[^/]*/python.\../.*" \
23b3e9
            | sed -e "s|.*/usr/lib[^/]*/python\(.\..\)/.*|$1python(abi) = \1|g" \
23b3e9
            | sort | uniq
23b3e9
    fi
23b3e9
    ;;
23b3e9
esac
23b3e9
23b3e9
exit 0