SliTaz Packages

Community Doc Forum Pro Shop Bugs Hg
.

Receipt for package "python3"

# SliTaz package receipt.

PACKAGE="python3"
VERSION="3.9.19"
CATEGORY="development"
SHORT_DESC="The Python 3 programming language."
MAINTAINER="shann@slitaz.org"
LICENSE="GPL"
SOURCE="Python"
TARBALL="$SOURCE-$VERSION.tar.xz"
WEB_SITE="https://www.python.org/"
WGET_URL="https://www.python.org/ftp/python/$VERSION/$TARBALL"

RELATED="python3-dev python3-idle" # version must match
DEPENDS="openssl bzlib readline sqlite zlib ncursesw gdbm libffi"
BUILD_DEPENDS="openssl-dev bzip2-dev readline-dev sqlite-dev zlib-dev \
expat-dev liblzma-dev ncursesw-dev tcl-dev db-dev gdbm-dev libffi-dev"

# What is the latest version available today?
current_version()
{
    wget -O - https://www.python.org/downloads/ 2>/dev/null | \
    sed '/Download Python [0-9]/!d;s|.*Python ||;s|<.*||;q'
}

# Rules to configure and make the package.
compile_rules()
{

    case "$ARCH" in
        arm*)
            # First pass for build host tools
            unset CFLAGS CXXFLAGS
            cp -f $CONFIG_SITE .
            CONFIG_SITE="$(pwd)/cook.site"
            cat >> $CONFIG_SITE << EOT
ac_cv_have_long_long_format=yes
EOT
            ./configure CC=gcc \
                --disable-ipv6 \
                --build=i486-slitaz-linux \
                --host=${BUILD_SYSTEM} && 
            make python Parser/pgen &&
            mv python hostpython &&
            mv Parser/pgen Parser/hostpgen || exit 1
            make distclean
            rm -f $CONFIG_SITE
            # Second pass for host tools
            . /etc/slitaz/cook.conf
            #patch -p1 < $stuff/python-2.7.3-xcompile.patch || exit 1
            cp -f $CONFIG_SITE .
            CONFIG_SITE="$(pwd)/cook.site"
            cat >> $CONFIG_SITE << EOT
ac_cv_have_long_long_format=yes
ac_cv_buggy_getaddrinfo=no
ac_cv_file__dev_ptmx=yes
ac_cv_file__dev_ptc=no
EOT
            ./configure CC=${HOST_SYSTEM}-gcc \
                --disable-ipv6 \
                --enable-shared \
                --with-system-ffi \
                ${CONFIGURE_ARGS} &&
            make \
                PYTHON_FOR_BUILD=${src}/hostpython \
                HOSTPYTHON=${src}/hostpython \
                HOSTPGEN=${src}/Parser/hostpgen \
                CROSS_COMPILE_TARGET=yes \
                HOSTARCH=${HOST_SYSTEM} \
                BUILDARCH=${BUILD_SYSTEM} || exit 1
            make DESTDIR=$DESTDIR install || exit 1 ;;
        i?86|x86_64)
            CFLAGS="$CFLAGS -fPIC"
            ./configure \
                --enable-shared \
                --with-system-expat \
                --with-system-ffi \
                --without-ensurepip \
                --build=${HOST_SYSTEM} \
                --host=${HOST_SYSTEM} &&
                make && make DESTDIR=$DESTDIR install ;;
    esac

#    chmod 755 $install/usr/lib/libpython${VERSION%.*}m.so
    chmod 755 $install/usr/lib/libpython${VERSION%%.*}.so
    find $install -type f -name "*.pyc" -delete
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
    python_version=${VERSION:0:3}
#    mkdir -p $fs/usr/include/python${python_version}m
        mkdir -p $fs/usr
        mkdir $fs/usr/bin && mkdir $fs/usr/lib
    cp -a $install/usr/bin/* $fs/usr/bin
    cp -a $install/usr/lib/* $fs/usr/lib
    # needed for mercurial to work now
#    cp -a $install/usr/include/python${python_version}m/pyconfig.h \
#        $fs/usr/include/python${python_version}m
    rm -f $fs/usr/bin/*-config
    # Split IDLE with TK dep
    rm -f $fs/usr/bin/idle*
    rm -rf $fs/usr/lib/python3.9/idlelib
}

# Post install commands for Tazpkg.       
pre_install()  
{
        # Removed symlinks if python2 installed
        if [ -d ${1}${INSTALLED}/python2 ]; then                   
            rm -f /usr/bin/2to3
        fi
}

post_remove()
{
        if [ -d ${1}${INSTALLED}/python2 ]; then         
            ln -s /usr/bin/2to3-2.7 /usr/bin/2to3
        fi
}
6047 packages and 209931 files in current database (Wed Jun 26 15:35:30 2024)