cd Python-${surum}
_pybasever=2.7
# Hack to avoid building again
sed -i 's/^all:.*$/all: build_all/' Makefile

make DESTDIR="${PKG}" altinstall maninstall

rm "${PKG}"/usr/share/man/man1/python.1

ln -sf python${_pybasever}        "${PKG}"/usr/bin/python2
ln -sf python${_pybasever}-config "${PKG}"/usr/bin/python2-config
ln -sf python${_pybasever}.1      "${PKG}"/usr/share/man/man1/python2.1

# FS#33954
ln -sf python-${_pybasever}.pc    "${PKG}"/usr/lib/pkgconfig/python2.pc

ln -sf ../../libpython${_pybasever}.so "${PKG}"/usr/lib/python${_pybasever}/config/libpython${_pybasever}.so

mv "${PKG}"/usr/bin/smtpd.py "${PKG}"/usr/lib/python${_pybasever}/

# some useful "stuff"
install -dm755 "${PKG}"/usr/lib/python${_pybasever}/Tools/{i18n,scripts}
install -m755 Tools/i18n/{msgfmt,pygettext}.py "${PKG}"/usr/lib/python${_pybasever}/Tools/i18n/
install -m755 Tools/scripts/{README,*py} "${PKG}"/usr/lib/python${_pybasever}/Tools/scripts/

# fix conflicts with python
mv "${PKG}"/usr/bin/idle{,2}
mv "${PKG}"/usr/bin/pydoc{,2}
mv "${PKG}"/usr/bin/2to3{,-2.7}

# clean-up reference to build directory
sed -i "s#${srcdir}/Python-${surum}:##" "${PKG}"/usr/lib/python${_pybasever}/config/Makefile
