python: split python-tkinter and idle-python into its own sourcepkg.

The reason is that there's cyclic dependency that must be avoided:
	python -> tk -> libX11 -> libxcb -> xcb-proto -> python

Be careful when adding cyclic dependencies; xbps-src -N is your friend.
This commit is contained in:
Juan RP 2014-08-26 12:11:33 +02:00
parent 00a0a67b75
commit 0a0c3de1d4
6 changed files with 98 additions and 29 deletions

View file

@ -1 +1 @@
python
python-tkinter

View file

@ -1 +0,0 @@
python

View file

@ -0,0 +1,83 @@
# Template build file for 'python-tkinter'.
#
# THIS PKG MUST BE SYNCHRONIZED WITH "srcpkgs/python"; IT IS SPLITTED TO AVOID
# A CYCLIC DEPENDENCY: python -> tk -> libX11 -> libxcb -> xcb-proto -> python
#
pkgname=python-tkinter
version=2.7.8
revision=5
wrksrc="Python-${version}"
hostmakedepends="pkg-config"
makedepends="
libffi-devel readline-devel>=6.3 gdbm-devel libressl-devel expat-devel
sqlite-devel bzip2-devel zlib-devel tk-devel"
pycompile_module="lib-tk"
short_desc="Interpreted, interactive, object-oriented programming language - GUI toolkit for Python2"
maintainer="Juan RP <xtraeme@gmail.com>"
homepage="http://www.python.org"
license="PSF"
distfiles="http://www.python.org/ftp/python/$version/Python-$version.tar.xz"
checksum=edde10a0cb7d14e2735e682882d5b287028d1485c456758154c19573db68075a
pre_configure() {
# Ensure that internal copies of expat, libffi and zlib are not used.
rm -r Modules/expat
rm -r Modules/_ctypes/libffi*
rm -r Modules/zlib
}
do_configure() {
unset GCC CC CXX CPP LD AR AS RANLIB
if [ "$CROSS_BUILD" ]; then
mkdir -p host-build
cd host-build
env -i PATH=$PATH ../configure
env -i PATH=$PATH make ${makejobs} python
mkdir -p ../hostpython
mv python ../hostpython
cd ..
patch -Np0 -i ${FILESDIR}/Python-2.7.6-xcompile.patch
fi
./configure ${configure_args} --build=${XBPS_MACHINE}-unknown-linux-gnu \
--with-threads --enable-ipv6 --with-signal-module \
--with-system-ffi --enable-unicode=ucs4 --with-system-expat \
--with-wctype-functions --enable-shared \
ac_cv_file__dev_ptc=no ac_cv_file__dev_ptmx=yes \
ac_cv_have_long_long_format=yes
}
do_build() {
# Avoid invoking pgen for cross-compiles.
touch Include/graminit.h Python/graminit.c
export PATH="$PATH:$wrksrc/hostpython"
make ${makejobs}
}
do_install() {
export PATH="$PATH:$wrksrc/hostpython"
make DESTDIR=${wrksrc}/${pkgname}-${version}-install altinstall
# We only care for the idle and tk modules.
vmkdir usr/bin
vmkdir usr/lib/python2.7/lib-dynload
mv ${wrksrc}/${pkgname}-${version}-install/usr/bin/idle ${DESTDIR}/usr/bin
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 \
${DESTDIR}/usr/lib/python2.7/
mv ${wrksrc}/${pkgname}-${version}-install/usr/lib/python2.7/lib-dynload/_tkinter.so \
${DESTDIR}/usr/lib/python2.7/lib-dynload/
}
idle-python_package() {
noarch=yes
depends="python-tkinter>=${version}_${revision}"
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
}
}

View file

@ -1,12 +1,15 @@
# Template build file for 'python'.
#
# THIS PKG MUST BE SYNCHRONIZED WITH "srcpkgs/python-tkinter".
#
pkgname=python
version=2.7.8
revision=4
revision=5
wrksrc="Python-${version}"
hostmakedepends="pkg-config"
makedepends="
libffi-devel readline-devel>=6.3 gdbm-devel libressl-devel expat-devel
sqlite-devel bzip2-devel zlib-devel tcl-devel tk-devel libX11-devel"
sqlite-devel bzip2-devel zlib-devel"
pycompile_dirs="usr/lib/python2.7"
short_desc="Interpreted, interactive, object-oriented programming language"
maintainer="Juan RP <xtraeme@gmail.com>"
@ -52,18 +55,22 @@ do_build() {
do_install() {
export PATH="$PATH:$wrksrc/hostpython"
make DESTDIR=${DESTDIR} altinstall
ln -sf /usr/bin/python2.7 ${DESTDIR}/usr/bin/python2
ln -sf /usr/bin/python2.7 ${DESTDIR}/usr/bin/python
ln -sf /usr/bin/python2.7-config ${DESTDIR}/usr/bin/python-config
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
}
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
# Remove files that belong to python-tkinter and idle-python
rm ${DESTDIR}/usr/bin/idle
rm -r ${DESTDIR}/usr/lib/python2.7/idlelib
rm -r ${DESTDIR}/usr/lib/python2.7/lib-tk
# Remove test module and tests that fail to be byte-compiled.
rm -rf ${DESTDIR}/usr/lib/python2.7/test
rm -rf ${DESTDIR}/usr/lib/python2.7/lib2to3/tests
rm -r ${DESTDIR}/usr/lib/python2.7/test
rm -r ${DESTDIR}/usr/lib/python2.7/lib2to3/tests
}
python-devel_package() {
@ -79,23 +86,3 @@ python-devel_package() {
${DESTDIR}/usr/include/python2.7
}
}
python-tkinter_package() {
depends="${sourcepkg}>=${version}_${revision}"
short_desc+=" - GUI toolkit for Python2"
pkg_install() {
vmove usr/lib/python2.7/lib-tk
vmove usr/lib/python2.7/lib-dynload/_tkinter.so
}
}
idle-python_package() {
depends="${sourcepkg}>=${version}_${revision} python-tkinter"
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
}
}