1 # Maintainer: Angel Velasquez <angvp@archlinux.org>
2 # Maintainer: Felix Yan <felixonmars@archlinux.org>
3 # Contributor: Stéphane Gaudreault <stephane@archlinux.org>
4 # Contributor: Allan McRae <allan@archlinux.org>
5 # Contributor: Jason Chu <jason@archlinux.org>
10 pkgname=(python python-tests)
13 _pybasever=${pkgver%.*}
14 pkgdesc="Next generation of the python high-level scripting language"
17 url="https://www.python.org/"
18 depends=('bzip2' 'expat' 'gdbm' 'libffi' 'libnsl' 'libxcrypt' 'openssl' 'zlib')
19 makedepends=('tk' 'sqlite' 'bluez-libs' 'mpdecimal' 'llvm' 'gdb' 'xorg-server-xvfb' 'ttf-font')
20 source=("https://www.python.org/ftp/python/${pkgver%rc*}/Python-${pkgver}.tar.xz"{,.asc})
21 sha512sums=('a3bba4b69322a47bfeefe42ba0fd7331b5b67fd2ab41441e2219d16ef8c6f307f1a48977afd073c18cfd24ec6cb1bfe0c4bb4b273031eb524dc7e9fb5fbcc3b6'
23 validpgpkeys=('0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D' # Ned Deily (Python release signing key) <nad@python.org>
24 'E3FF2839C048B25C084DEBE9B26995E310250568' # Łukasz Langa (GPG langa.pl) <lukasz@langa.pl>
25 'A035C8C19219BA821ECEA86B64E628F8D684696D') # Pablo Galindo Salgado <pablogsal@gmail.com>
31 sed -i -e "s|^#.* /usr/local/bin/python|#!/usr/bin/python|" Lib/cgi.py
33 # Ensure that we are using the system copy of various libraries (expat, libffi, and libmpdec),
34 # rather than copies shipped in the tarball
36 rm -r Modules/_ctypes/{darwin,libffi}*
37 rm -r Modules/_decimal/libmpdec
43 # PGO should be done with -O3
44 CFLAGS="${CFLAGS/-O2/-O3} -ffat-lto-objects"
46 # Disable bundled pip & setuptools
47 ./configure --prefix=/usr \
49 --with-computed-gotos \
50 --enable-optimizations \
54 --with-dbmliborder=gdbm:ndbm \
55 --with-system-libmpdec \
56 --enable-loadable-sqlite-extensions \
58 --with-tzpath=/usr/share/zoneinfo
60 # Obtain next free server number for xvfb-run; this even works in a chroot environment.
62 while ! xvfb-run -a -n "$servernum" /bin/true 2>/dev/null; do servernum=$((servernum+1)); done
64 LC_CTYPE=en_US.UTF-8 xvfb-run -s "-screen 0 1920x1080x16 -ac +extension GLX" -a -n "$servernum" make EXTRA_CFLAGS="$CFLAGS"
68 # test_tk: test_askcolor tkinter.test.test_tkinter.test_colorchooser.DefaultRootTest hangs
69 # test_pyexpat: our `debug` implementation rewrites source location, which breaks the build-time
70 # only test test.test_pyexpat.HandlerExceptionTest as it cannot find source file in
71 # the to-be-installed debug package
75 # Obtain next free server number for xvfb-run; this even works in a chroot environment.
77 while ! xvfb-run -a -n "$servernum" /bin/true 2>/dev/null; do servernum=$((servernum+1)); done
79 LD_LIBRARY_PATH="${srcdir}/Python-${pkgver}":${LD_LIBRARY_PATH} \
80 LC_CTYPE=en_US.UTF-8 xvfb-run -s "-screen 0 1920x1080x16 -ac +extension GLX" -a -n "$servernum" \
81 "${srcdir}/Python-${pkgver}/python" -m test.regrtest -v -uall -x test_tk -x test_pyexpat
85 optdepends=('python-setuptools'
88 'mpdecimal: for decimal'
96 # Hack to avoid building again
97 sed -i 's/^all:.*$/all: build_all/' Makefile
99 # PGO should be done with -O3
100 CFLAGS="${CFLAGS/-O2/-O3}"
102 make DESTDIR="${pkgdir}" EXTRA_CFLAGS="$CFLAGS" install
104 # Why are these not done by default...
105 ln -s python3 "${pkgdir}"/usr/bin/python
106 ln -s python3-config "${pkgdir}"/usr/bin/python-config
107 ln -s idle3 "${pkgdir}"/usr/bin/idle
108 ln -s pydoc3 "${pkgdir}"/usr/bin/pydoc
109 ln -s python${_pybasever}.1 "${pkgdir}"/usr/share/man/man1/python.1
111 # some useful "stuff" FS#46146
112 install -dm755 "${pkgdir}"/usr/lib/python${_pybasever}/Tools/{i18n,scripts}
113 install -m755 Tools/i18n/{msgfmt,pygettext}.py "${pkgdir}"/usr/lib/python${_pybasever}/Tools/i18n/
114 install -m755 Tools/scripts/{README,*py} "${pkgdir}"/usr/lib/python${_pybasever}/Tools/scripts/
117 install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
120 cd "$pkgdir"/usr/lib/python*/
121 rm -r {ctypes/test,distutils/tests,idlelib/idle_test,lib2to3/tests,tkinter/test,unittest/test}
127 package_python-tests() {
128 pkgdesc="Regression tests packages for Python"
133 make DESTDIR="${pkgdir}" EXTRA_CFLAGS="$CFLAGS" libinstall
134 cd "$pkgdir"/usr/lib/python*/
135 rm -r !(test|ctypes|distutils|idlelib|lib2to3|tkinter|unittest)
136 cd "$pkgdir"/usr/lib/python*/test
138 cd "$pkgdir"/usr/lib/python*/ctypes
140 cd "$pkgdir"/usr/lib/python*/distutils
142 cd "$pkgdir"/usr/lib/python*/idlelib
144 cd "$pkgdir"/usr/lib/python*/lib2to3
146 cd "$pkgdir"/usr/lib/python*/tkinter
148 cd "$pkgdir"/usr/lib/python*/unittest