python2: clean up alternatives, merge python2-tkinter

This commit is contained in:
Andrew J. Hesford 2025-01-31 11:31:34 -05:00
parent 9679cebc41
commit 766650b66d
8 changed files with 46 additions and 116 deletions

View file

@ -1 +1 @@
python2-tkinter
python2

1
srcpkgs/python2-tkinter Symbolic link
View file

@ -0,0 +1 @@
python2

View file

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

View file

@ -1,90 +0,0 @@
# Template file for 'python2-tkinter'
#
# THIS PKG MUST BE SYNCHRONIZED WITH "srcpkgs/python2"; IT IS SPLITTED TO AVOID
# A CYCLIC DEPENDENCY: python2 -> tk -> libX11 -> libxcb -> xcb-proto -> python2
#
_desc="Interpreted, interactive, object-oriented programming language"
pkgname=python2-tkinter
version=2.7.18.11
revision=1
_commit=a22a1d856ea8c656debe6f9a8fe9fee1ffc3f144
pycompile_dirs="usr/lib/python2.7/lib-tk"
hostmakedepends="pkg-config"
makedepends="libffi-devel readline-devel gdbm-devel openssl-devel expat-devel
sqlite-devel bzip2-devel zlib-devel tk-devel"
short_desc="${_desc} - GUI toolkit for Python2"
maintainer="Leah Neukirchen <leah@vuxu.org>"
license="Python-2.0"
homepage="https://www.python.org"
distfiles="https://github.com/ActiveState/cpython/archive/${_commit}.tar.gz"
checksum=aeb7b021405093b8687239009e5dadb2cb4099e69e75a246d6279770a5fee3af
if [ "$XBPS_TARGET_LIBC" = "glibc" ]; then
makedepends+=" libxcrypt-devel"
fi
pre_configure() {
# Ensure that internal copies of expat and libffi are not used.
rm -r Modules/expat
rm -r Modules/_ctypes/libffi*
# Enable loading sqlite extensions.
vsed -i '/SQLITE_OMIT_LOAD_EXTENSION/d' setup.py
}
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 XBPS_ARCH=$XBPS_ARCH ../configure
env -i PATH=$PATH XBPS_ARCH=$XBPS_ARCH make ${makejobs} python
mkdir -p ../hostpython
mv python ../hostpython
cd ..
patch -Np0 -i ${FILESDIR}/cross.patch
fi
./configure ${configure_args} \
--enable-shared --enable-ipv6 --with-threads --enable-unicode=ucs4 \
--with-computed-gotos --with-wctype-functions --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"
mkdir -p ${wrksrc}/tmp-destdir/usr/lib
ln -s lib ${wrksrc}/tmp-destdir/usr/lib${XBPS_TARGET_WORDSIZE}
make DESTDIR=${wrksrc}/tmp-destdir altinstall
# We only care for the idle and tk modules.
vmkdir usr/bin
vmkdir usr/lib/python2.7/lib-dynload
mv ${wrksrc}/tmp-destdir/usr/bin/idle ${DESTDIR}/usr/bin/idle2.7
mv ${wrksrc}/tmp-destdir/usr/lib/python2.7/idlelib \
${DESTDIR}/usr/lib/python2.7/
mv ${wrksrc}/tmp-destdir/usr/lib/python2.7/lib-tk \
${DESTDIR}/usr/lib/python2.7/
mv ${wrksrc}/tmp-destdir/usr/lib/python2.7/lib-dynload/_tkinter.so \
${DESTDIR}/usr/lib/python2.7/lib-dynload/
ln -sf idle2.7 ${DESTDIR}/usr/bin/idle2
}
idle-python2_package() {
short_desc="${_desc} - IDE for Python2 using Tkinter"
pycompile_dirs="usr/lib/python2.7/idlelib"
depends="${sourcepkg}-${version}_${revision}"
pkg_install() {
vmove usr/bin/idle2*
vmove usr/lib/python2.7/idlelib
vinstall ${FILESDIR}/idle2.xpm 644 usr/share/pixmaps
vinstall ${FILESDIR}/idle2.desktop 644 usr/share/applications
}
}

View file

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

View file

@ -1,15 +1,12 @@
# Template file for 'python2'
#
# THIS PKG MUST BE SYNCHRONIZED WITH "srcpkgs/python2-tkinter".
#
pkgname=python2
version=2.7.18.11
revision=1
revision=2
_commit=a22a1d856ea8c656debe6f9a8fe9fee1ffc3f144
pycompile_dirs="usr/lib/python2.7"
hostmakedepends="pkg-config"
makedepends="libffi-devel readline-devel gdbm-devel openssl-devel expat-devel
sqlite-devel bzip2-devel zlib-devel"
sqlite-devel bzip2-devel zlib-devel tk-devel"
depends="ca-certificates"
short_desc="Interpreted, interactive, object-oriented programming language"
maintainer="Leah Neukirchen <leah@vuxu.org>"
@ -21,7 +18,6 @@ checksum=aeb7b021405093b8687239009e5dadb2cb4099e69e75a246d6279770a5fee3af
short_desc+=" (limited install; not for regular use)"
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
@ -79,25 +75,28 @@ do_install() {
post_install() {
chmod 755 ${DESTDIR}/usr/lib/libpython*.so*
vlicense 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
rm -r ${DESTDIR}/usr/lib/python2.7/lib-tk
rm ${DESTDIR}/usr/bin/smtpd.py
mv ${DESTDIR}/usr/bin/2to3{,-${py2_ver}}
mv ${DESTDIR}/usr/bin/pydoc{,${py2_ver}}
mv ${DESTDIR}/usr/bin/idle{,${py2_ver}}
ln -sf "idle${py2_ver}" "${DESTDIR}/usr/bin/idle2"
# Remove test module and tests that fail to be byte-compiled.
rm -r ${DESTDIR}/usr/lib/python2.7/test
rm -r ${DESTDIR}/usr/lib/python2.7/lib2to3/tests
rm -r ${DESTDIR}/${py2_lib}/test
rm -r ${DESTDIR}/${py2_lib}/lib2to3/tests
# Remove references to the install(1) wrapper.
vsed -e "s,${XBPS_WRAPPERDIR},/usr/bin,g" -i \
${DESTDIR}/usr/lib/python${version%.*.*}/_sysconfigdata.py \
${DESTDIR}/usr/lib/python${version%.*.*}/config/Makefile
${DESTDIR}/${py2_lib}/_sysconfigdata.py \
${DESTDIR}/${py2_lib}/config/Makefile
if [ "$CROSS_BUILD" ]; then
# Remove references to cross toolchain.
vsed -i "s/$XBPS_CROSS_TRIPLET-//g" \
${DESTDIR}/usr/lib/python${version%.*.*}/_sysconfigdata.py \
${DESTDIR}/usr/lib/python${version%.*.*}/config/Makefile
${DESTDIR}/${py2_lib}/_sysconfigdata.py \
${DESTDIR}/${py2_lib}/config/Makefile
fi
}
@ -108,9 +107,31 @@ python2-devel_package() {
vmove usr/bin/python*-config
vmove usr/lib/pkgconfig
vmove usr/include
vmove usr/lib/python2.7/config/libpython2.7.a
mkdir -p ${DESTDIR}/usr/include/python2.7
mv ${PKGDESTDIR}/usr/include/python2.7/pyconfig.h \
${DESTDIR}/usr/include/python2.7
vmove "${py2_lib}/config/libpython2.7.a"
# Restore pyconfig.h to main package
mkdir -p "${DESTDIR}/${py2_inc}"
mv "${PKGDESTDIR}/${py2_inc}/pyconfig.h" "${DESTDIR}/${py2_inc}"
}
}
python2-tkinter_package() {
short_desc+=" - GUI toolkit for Python2"
depens="${sourcepkg}>=${version}_${revision}"
pkg_install() {
vmove "${py2_lib}/lib-tk"
vmove "${py2_lib}/lib-dynload/_tkinter.so"
}
}
idle-python2_package() {
short_desc="${_desc} - IDE for Python2 using Tkinter"
pycompile_dirs="usr/lib/python2.7/idlelib"
depends="${sourcepkg}-${version}_${revision}"
pkg_install() {
vmove usr/bin/idle*
vmove usr/lib/python2.7/idlelib
vinstall ${FILESDIR}/idle2.xpm 644 usr/share/pixmaps
vinstall ${FILESDIR}/idle2.desktop 644 usr/share/applications
}
}