#Packager: Dimitris Tzemos pkgname=python3 pkgver=3.5.2 pkgrel=1dj source=("https://www.python.org/ftp/python/3.5.2/Python-$pkgver.tar.xz" "python3.no-static-library.diff" "python3.x86_64.diff" "python3.readline.set_pre_input_hook.diff") sourcetemplate=http://people.salixos.org/djemos/salix/$pkgname/$pkgver/ url=https://www.python.org/ slackdesc=\ ( #|-----handy-ruler------------------------------------------------------| "python3 (object-oriented interpreted programming language)" "Python is an interpreted, interactive, object-oriented programming" "language that combines remarkable power with very clear syntax." "This is a new version of the language that is incompatible with the" "2.x line of releases. The language is mostly the same, but many" "details, especially how built-in objects like dictionaries and strings" "work, have changed considerably, and a lot of deprecated features have" "finally been removed. Also, the standard library has been reorganized" "in a few prominent places." ) build() { cd $startdir/src/Python-$pkgver PYVER=$(cut -d. -f1,2 <<< "$pkgver") # Location for Python site-packages. SITEPK=$PKG/usr/lib${LIBDIRSUFFIX}/python${PYVER}/site-packages # Same as above without $PKG. TOOLSDIR=/usr/lib${LIBDIRSUFFIX}/python${PYVER}/site-packages patch -p1 -i $startdir/src/python3.readline.set_pre_input_hook.diff || return 1 # We don't want a large libpython*.a. patch -p1 -i $startdir/src/python3.no-static-library.diff || return 1 if [ "$arch" = "x86_64" ]; then # Install to lib64 instead of lib. patch -p1 -i $startdir/src/python3.x86_64.diff || return 1 fi # Fix python3 path in cgi.py. sed -i '1s|^#.*/usr/local/bin/python|#!/usr/bin/python3|' Lib/cgi.py # If this system already has Python3 with pip in site-packages, ignore it and # install pip anyway. sed -i 's|\("install",\)|\1 "--ignore-installed",|' Lib/ensurepip/__init__.py ./configure \ --prefix=/usr \ --libdir=/usr/lib${LIBDIRSUFFIX} \ --mandir=/usr/man \ --docdir=/usr/doc/$pkgname-$pkgver \ --with-threads \ --enable-ipv6 \ --enable-shared \ --with-system-expat \ --with-system-ffi \ --build=$arch-slackware-linux make -j $numjobs || return 1 make install DESTDIR=$startdir/pkg # Restore original ensurepip behaviour. sed -i 's|\("install",\) "--ignore-installed",|\1|' \ $PKG/usr/lib${LIBDIRSUFFIX}/python${PYVER}/ensurepip/__init__.py # Remove to avoid overwriting a copy from Python2. rm -f $PKG/usr/bin/2to3 # We'll install the python-tools under site-packages. mkdir -p $SITEPK cp -a Tools/* $SITEPK # Remove DOS batch/exe files. find $PKG \( -name '*.exe' -o -name '*.bat' \) -exec rm -f '{}' \; # Fix permissions on dynamic libraries. find $PKG -type f -perm 555 -exec chmod 755 '{}' \; # Install docs. mkdir -p $PKG/usr/doc/$pkgname-$pkgver cp -a README LICENSE Misc $PKG/usr/doc/$pkgname-$pkgver mv $SITEPK/README $PKG/usr/doc/$pkgname-$pkgver/README.python-tools ( cd $PKG/usr/doc/$pkgname-$pkgver ; ln -sf $TOOLSDIR Tools ) if [ -e "$SRC/python-$pkgver-docs-html.tar.bz2" ]; then tar xf $SRC/python-$pkgver-docs-html.tar.bz2 mv python-$pkgver-docs-html $PKG/usr/doc/$pkgname-$pkgver/html chown -R root:root $PKG/usr/doc/$pkgname-$pkgver/html fi }