python: add alternatives

This commit is contained in:
Alessio Sergi 2016-04-25 01:37:19 +02:00
parent ffff9d749d
commit bba8325dd0
5 changed files with 26 additions and 18 deletions

View File

@ -1,9 +0,0 @@
[Desktop Entry]
Name=IDLE
Comment=IDE for Python2
Exec=idle
Icon=idle
Terminal=false
Type=Application
Categories=Development;
StartupNotify=true

View File

@ -0,0 +1,9 @@
[Desktop Entry]
Name=IDLE (using Python2.7)
Comment=IDE for Python (using Python2.7)
Exec=idle2.7
Icon=idle2.7
Terminal=false
Type=Application
Categories=Development;
StartupNotify=true

View File

@ -5,7 +5,7 @@
#
pkgname=python-tkinter
version=2.7.11
revision=1
revision=2
wrksrc="Python-${version}"
hostmakedepends="pkg-config"
makedepends="
@ -65,7 +65,7 @@ do_install() {
else
_libdir=lib
fi
mv ${wrksrc}/${pkgname}-${version}-install/usr/bin/idle ${DESTDIR}/usr/bin
mv ${wrksrc}/${pkgname}-${version}-install/usr/bin/idle ${DESTDIR}/usr/bin/idle2.7
mv ${wrksrc}/${pkgname}-${version}-install/usr/lib/python2.7/idlelib \
${DESTDIR}/usr/lib/python2.7/
mv ${wrksrc}/${pkgname}-${version}-install/usr/lib/python2.7/lib-tk \
@ -80,9 +80,9 @@ idle-python_package() {
pycompile_module="idlelib"
short_desc+=" - IDE for Python2 using Tkinter"
pkg_install() {
vmove usr/bin/idle
vmove usr/lib/python2.7/idlelib
vinstall ${FILESDIR}/idle.xpm 644 usr/share/pixmaps
vinstall ${FILESDIR}/idle.desktop 644 usr/share/applications
vmove usr/bin/idle${version%.*}
vmove usr/lib/python${version%.*}/idlelib
vinstall ${FILESDIR}/idle${version%.*}.xpm 644 usr/share/pixmaps
vinstall ${FILESDIR}/idle${version%.*}.desktop 644 usr/share/applications
}
}

View File

@ -4,7 +4,7 @@
#
pkgname=python
version=2.7.11
revision=7
revision=8
wrksrc="Python-${version}"
hostmakedepends="pkg-config"
makedepends="
@ -19,6 +19,14 @@ license="PSF"
distfiles="http://www.python.org/ftp/python/$version/Python-$version.tar.xz"
checksum=962b4c45af50124ea61f11a30deb4342fc0bc21126790fa1d7f6c79809413f46
alternatives="
python:idle:/usr/bin/idle2.7
python:2to3:/usr/bin/2to3-2.7
python:pydoc:/usr/bin/pydoc2.7
python:python:/usr/bin/python2.7
python:python2:/usr/bin/python2.7
python:python.1:/usr/share/man/man1/python2.7.1"
pre_configure() {
# Ensure that internal copies of expat, libffi and zlib are not used.
rm -r Modules/expat
@ -56,8 +64,6 @@ do_build() {
do_install() {
export PATH="$PATH:$wrksrc/hostpython"
make DESTDIR=${DESTDIR} altinstall
ln -sf python2.7 ${DESTDIR}/usr/bin/python2
ln -sf python2.7 ${DESTDIR}/usr/bin/python
ln -sf python2.7-config ${DESTDIR}/usr/bin/python-config
}
@ -65,6 +71,8 @@ post_install() {
chmod 755 ${DESTDIR}/usr/lib/libpython*.so*
install -Dm644 LICENSE ${DESTDIR}/usr/share/licenses/python/LICENSE
rm -f ${DESTDIR}/usr/bin/smtpd.py
mv ${DESTDIR}/usr/bin/2to3{,-2.7}
mv ${DESTDIR}/usr/bin/pydoc{,2.7}
# Remove files that belong to python-tkinter and idle-python
rm ${DESTDIR}/usr/bin/idle
rm -r ${DESTDIR}/usr/lib/python2.7/idlelib