Skip to content

Commit

Permalink
python2: clean up alternatives, merge python2-tkinter
Browse files Browse the repository at this point in the history
  • Loading branch information
ahesford committed Feb 9, 2025
1 parent 9679ceb commit 766650b
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 116 deletions.
2 changes: 1 addition & 1 deletion srcpkgs/idle-python2
1 change: 1 addition & 0 deletions srcpkgs/python2-tkinter
1 change: 0 additions & 1 deletion srcpkgs/python2-tkinter/files/cross.patch

This file was deleted.

90 changes: 0 additions & 90 deletions srcpkgs/python2-tkinter/template

This file was deleted.

1 change: 0 additions & 1 deletion srcpkgs/python2-tkinter/update

This file was deleted.

File renamed without changes.
File renamed without changes.
67 changes: 44 additions & 23 deletions srcpkgs/python2/template
Original file line number Diff line number Diff line change
@@ -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>"
Expand All @@ -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
Expand Down Expand Up @@ -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
}

Expand All @@ -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
}
}

0 comments on commit 766650b

Please sign in to comment.