python3: split tkinter and idle into its own sourcepkg

Add a separate sourcepkg for tkinter to avoid a cyclic build time
dependency.
This commit is contained in:
Alessio Sergi 2018-03-26 18:48:48 +02:00
parent d440dc11ba
commit 5481f5ecbb
8 changed files with 108 additions and 28 deletions

View file

@ -1 +1 @@
python3
python3-tkinter

View file

@ -1 +0,0 @@
python3

View file

@ -0,0 +1 @@
../../python3/files/cross.patch

View file

@ -0,0 +1,91 @@
# Template file for 'python3-tkinter'.
#
# THIS PKG MUST BE SYNCHRONIZED WITH "srcpkgs/python3"; IT IS SPLITTED TO AVOID
# A CYCLIC DEPENDENCY: python3 -> tk -> libX11 -> libxcb -> xcb-proto -> python3
#
_desc="Interpreted, interactive, object-oriented programming language"
pkgname=python3-tkinter
version=3.6.4
revision=4
wrksrc="Python-${version}"
hostmakedepends="pkg-config"
pycompile_dirs="
usr/lib/python${version%.*}/tkinter
usr/lib/python${version%.*}/turtledemo
usr/lib/python${version%.*}/turtle.py"
makedepends="libffi-devel readline-devel gdbm-devel libressl-devel expat-devel
sqlite-devel bzip2-devel zlib-devel tk-devel"
short_desc="${_desc} - GUI toolkit for Python3"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
homepage="https://www.python.org"
license="PSF-2"
distfiles="https://www.python.org/ftp/python/${version}/Python-${version}.tar.xz"
checksum=159b932bf56aeaa76fd66e7420522d8c8853d486b8567c459b84fe2ed13bcaba
pre_configure() {
# Ensure that internal copies of zlib, expat and libffi are not used.
rm -r Modules/zlib
rm -r Modules/expat
rm -r Modules/_ctypes/{darwin,libffi}*
}
do_configure() {
local _args
unset GCC CC CXX CPP LD AR AS RANLIB
if [ "$CROSS_BUILD" ]; then
mkdir -p host-build
cd host-build
env -i PATH=$PATH CFLAGS=-Os ../configure
env -i PATH=$PATH make ${makejobs} python
mkdir -p ../hostpython
mv python ../hostpython
cd ..
patch -Np0 -i ${FILESDIR}/cross.patch
_args="--build=${XBPS_MACHINE%%-musl}"
fi
./configure ${configure_args} ${_args} \
--enable-shared --enable-ipv6 --enable-loadable-sqlite-extensions \
--with-threads --with-computed-gotos --with-dbmliborder=gdbm:ndbm \
--with-system-expat --with-system-ffi --without-ensurepip
}
do_build() {
export PATH="$PATH:$wrksrc/hostpython"
make ${makejobs}
}
do_install() {
export PATH="$PATH:$wrksrc/hostpython"
make DESTDIR=${wrksrc}/${pkgname}-${version}-install altinstall
vlicense LICENSE
# We only care for the idle and tkinter modules.
vmkdir usr/bin
vmkdir usr/lib/python${version%.*}/lib-dynload
if [ -e ${wrksrc}/${pkgname}-${version}-install/usr/lib32 ]; then
_libdir=lib32
else
_libdir=lib
fi
mv ${wrksrc}/${pkgname}-${version}-install/usr/bin/idle${version%.*} \
${DESTDIR}/usr/bin/idle${version%.*}
for lib in idlelib tkinter turtledemo turtle.py; do
mv ${wrksrc}/${pkgname}-${version}-install/usr/lib/python${version%.*}/${lib} \
${DESTDIR}/usr/lib/python${version%.*}/
done
mv ${wrksrc}/${pkgname}-${version}-install/usr/${_libdir}/python${version%.*}/lib-dynload/_tkinter.cpython-*m*.so \
${DESTDIR}/usr/lib/python${version%.*}/lib-dynload/
ln -sf idle${version%.*} ${DESTDIR}/usr/bin/idle3
}
idle-python3_package() {
noarch=yes
short_desc="${_desc} - IDE for Python3 using Tkinter"
pycompile_dirs="usr/lib/python${version%.*}/idlelib"
depends="${sourcepkg}-${version}_${revision}"
pkg_install() {
vmove usr/bin/idle3*
vmove usr/lib/python${version%.*}/idlelib
vinstall ${FILESDIR}/idle3.xpm 644 usr/share/pixmaps
vinstall ${FILESDIR}/idle3.desktop 644 usr/share/applications
}
}

View file

@ -0,0 +1 @@
../python3/update

View file

@ -1,18 +1,22 @@
# Template file for 'python3'
#
# THIS PKG MUST BE SYNCHRONIZED WITH "srcpkgs/python3-tkinter".
#
pkgname=python3
version=3.6.4
revision=3
revision=4
wrksrc="Python-${version}"
short_desc="Interpreted, interactive, object-oriented programming language (${version%.*} series)"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
homepage="https://www.python.org"
license="PSF"
license="PSF-2"
distfiles="https://www.python.org/ftp/python/${version}/Python-${version}.tar.xz"
checksum=159b932bf56aeaa76fd66e7420522d8c8853d486b8567c459b84fe2ed13bcaba
pycompile_dirs="usr/lib/python${version%.*}"
hostmakedepends="pkg-config"
makedepends="libffi-devel readline-devel gdbm-devel libressl-devel expat-devel
sqlite-devel bzip2-devel zlib-devel liblzma-devel tcl-devel tk-devel libX11-devel"
sqlite-devel bzip2-devel zlib-devel liblzma-devel"
depends="ca-certificates"
alternatives="
@ -57,6 +61,12 @@ do_install() {
vlicense LICENSE
rm -f ${DESTDIR}/usr/bin/2to3
# Remove files that belong to python3-tkinter and idle-python3
rm -f ${DESTDIR}/usr/bin/idle3*
rm -rf ${DESTDIR}/usr/lib/python${version%.*}/idlelib
rm -rf ${DESTDIR}/usr/lib/python${version%.*}/tkinter
rm -rf ${DESTDIR}/usr/lib/python${version%.*}/turtledemo
rm -f ${DESTDIR}/usr/lib/python${version%.*}/turtle.py
# Remove test module and tests that fail to be byte-compiled.
rm -rf ${DESTDIR}/usr/lib/python${version%.*}/test
rm -rf ${DESTDIR}/usr/lib/python${version%.*}/lib2to3/tests
@ -73,8 +83,8 @@ do_install() {
}
python3-devel_package() {
depends="${sourcepkg}-${version}_${revision}"
short_desc+=" - development files"
depends="${sourcepkg}-${version}_${revision}"
pkg_install() {
vmove usr/bin/python*-config
vmove usr/lib/pkgconfig
@ -86,25 +96,3 @@ python3-devel_package() {
${DESTDIR}/usr/include/python${version%.*}m
}
}
python3-tkinter_package() {
pycompile_dirs="usr/lib/python${version%.*}"
depends="${sourcepkg}-${version}_${revision}"
short_desc+=" - GUI toolkit for Python3"
pkg_install() {
vmove usr/lib/python${version%.*}/tkinter
vmove usr/lib/python${version%.*}/turtle.py
vmove usr/lib/python${version%.*}/turtledemo
vmove usr/lib/python${version%.*}/lib-dynload/_tkinter.cpython-*m*.so
}
}
idle-python3_package() {
pycompile_dirs="usr/lib/python${version%.*}/idlelib"
depends="${sourcepkg}-${version}_${revision} python3-tkinter"
short_desc+=" - IDE for Python3 using Tkinter"
pkg_install() {
vmove usr/bin/idle3*
vmove usr/lib/python${version%.*}/idlelib
vinstall ${FILESDIR}/idle3.xpm 644 usr/share/pixmaps
vinstall ${FILESDIR}/idle3.desktop 644 usr/share/applications
}
}