#!/bin/sh
rmln(){
    if [ -L "$2" ] ; then
        rm -f "$2"
    fi
    ln -s "$1" "$2"
}
if [ "$1" != "" ] ; then
    version="$1"
    if [ "$version" == "" ] || [ ! -f /usr/bin/python$version ] ; then
        echo "Python version is not available: $1"
        exit 1
    fi
    rmln pydoc$version /usr/bin/pydoc3
    rmln python$version /usr/bin/python3
    rmln python$version /usr/bin/python
    rmln idle$version /usr/bin/idle3
    rmln python$version-config /usr/bin/python3-config
    rmln 2to3-$version /usr/bin/2to3
    rmln pip$version /usr/bin/pip3
    rmln pip$version /usr/bin/pip
    rmln libpython3.so.$version /usr/lib64/libpython3.so
    rmln python-$version.pc /usr/lib64/pkgconfig/python3.pc
    rmln python-$version-embed.pc /usr/lib64/pkgconfig/python3-embed.pc
    
else
    exit 1
fi
