From 9973cf110a508b527f1e25d72a9bc250c6b5c100 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Sun, 14 Dec 2014 18:19:46 +0000
Subject: python2: update to 2.7.9

---
 abs/core/python2/PKGBUILD    | 105 ++++++++++++++++++++++++++++---------------
 abs/core/python2/__changelog |   2 +-
 2 files changed, 71 insertions(+), 36 deletions(-)

diff --git a/abs/core/python2/PKGBUILD b/abs/core/python2/PKGBUILD
index d670374..a9d67a1 100644
--- a/abs/core/python2/PKGBUILD
+++ b/abs/core/python2/PKGBUILD
@@ -1,26 +1,29 @@
-# $Id: PKGBUILD 157413 2012-04-28 09:27:14Z allan $
-# Maintainer: Stéphane Gaudreault <stephane@archlinux.org>
-# Contributer: Allan McRae <allan@archlinux.org>
-# Contributer: Jason Chu <jason@archlinux.org>
+# $Id$
+# Maintainer: Felix Yan <felixonmars@archlinux.org>
+# Contributor: Stéphane Gaudreault <stephane@archlinux.org>
+# Contributor: Allan McRae <allan@archlinux.org>
+# Contributor: Jason Chu <jason@archlinux.org>
 
 pkgname=python2
-pkgver=2.7.3
-pkgrel=2
+pkgver=2.7.9
+pkgrel=1
 _pybasever=2.7
 pkgdesc="A high-level scripting language"
 arch=('i686' 'x86_64')
 license=('PSF')
 url="http://www.python.org/"
 depends=('bzip2' 'gdbm' 'openssl' 'zlib' 'expat' 'sqlite' 'libffi')
-makedepends=('tk')
-optdepends=('tk: for IDLE')
+makedepends=('tk' 'bluez-libs')
+checkdepends=('gdb')
+optdepends=('tk: for IDLE'
+            'python2-setuptools'
+            'python2-pip')
 conflicts=('python<3')
-options=('!makeflags')
 source=(http://www.python.org/ftp/python/${pkgver%rc?}/Python-${pkgver}.tar.xz)
-sha1sums=('b2b0ada7ebed4a8204a855193afbdb3aa3308357')
+sha1sums=('3172f6e957713c2d9fca462cc16068222fd1b9d3')
 
-build() {
-  cd "${srcdir}/Python-${pkgver}"
+prepare() {
+  cd Python-${pkgver}
 
   # Temporary workaround for FS#22322
   # See http://bugs.python.org/issue10835 for upstream report
@@ -32,56 +35,88 @@ build() {
   # FS#23997
   sed -i -e "s|^#.* /usr/local/bin/python|#!/usr/bin/python2|" Lib/cgi.py
 
+  sed -i "s/python2.3/python2/g" Lib/distutils/tests/test_build_scripts.py \
+    Lib/distutils/tests/test_install_scripts.py
+
+  # TODO: Still not passed
+  # Silent test_gdb failures on 'no symbol table loaded'.
+  #sed -i '/ignore_patterns = (/a "No symbol table is loaded.  Use the \\"file\\" command.",' \
+  #  Lib/test/test_gdb.py
+
   # Ensure that we are using the system copy of various libraries (expat, zlib and libffi),
   # rather than copies shipped in the tarball
   rm -r Modules/expat
   rm -r Modules/zlib
   rm -r Modules/_ctypes/{darwin,libffi}*
 
+  # clean up #!s
+  find . -name '*.py' | \
+    xargs sed -i "s|#[ ]*![ ]*/usr/bin/env python$|#!/usr/bin/env python2|"
+
+  # Workaround asdl_c.py error after we touched the shebangs
+  touch Include/Python-ast.h Python/Python-ast.c
+}
+
+build() {
+  cd "${srcdir}/Python-${pkgver}"
+
   export OPT="${CFLAGS}"
-  ./configure --prefix=/usr --enable-shared --with-threads --enable-ipv6 \
-              --enable-unicode=ucs4 --with-system-expat --with-system-ffi \
-              --with-dbmliborder=gdbm:ndbm
+  ./configure --prefix=/usr \
+              --enable-shared \
+              --with-threads \
+              --enable-ipv6 \
+              --enable-unicode=ucs4 \
+              --with-system-expat \
+              --with-system-ffi \
+              --with-dbmliborder=gdbm:ndbm \
+              --without-ensurepip
 
   make
 }
 
+check() {
+  # As of 2.7.9, 2 tests failed:
+  # test_gdb test_mhlib
+  # Besides, test_thread disabled as it will stuck
+
+  cd Python-${pkgver}
+  LD_LIBRARY_PATH="${srcdir}/Python-${pkgver}":${LD_LIBRARY_PATH} \
+    "${srcdir}/Python-${pkgver}/python" -m test.regrtest -v -uall -x test_thread || warning "Tests failed"
+}
+
 package() {
-  cd "${srcdir}/Python-${pkgver}"
+  cd Python-${pkgver}
   make DESTDIR="${pkgdir}" altinstall maninstall
 
-  ln -sf python${_pybasever}        "${pkgdir}/usr/bin/python2"
-  ln -sf python${_pybasever}-config "${pkgdir}/usr/bin/python2-config"
-  ln -sf python${_pybasever}.1      "${pkgdir}/usr/share/man/man1/python2.1"
-  #jm
+  #LinHES
   ln -sf python2               "${pkgdir}/usr/bin/python"
-  
 
-  ln -sf ../../libpython${_pybasever}.so \
-    "${pkgdir}/usr/lib/python${_pybasever}/config/libpython${_pybasever}.so"
+  rm "${pkgdir}"/usr/share/man/man1/python.1
+
+  ln -sf python${_pybasever}        "${pkgdir}"/usr/bin/python2
+  ln -sf python${_pybasever}-config "${pkgdir}"/usr/bin/python2-config
+  ln -sf python${_pybasever}.1      "${pkgdir}"/usr/share/man/man1/python2.1
 
-  mv "${pkgdir}/usr/bin/smtpd.py" "${pkgdir}/usr/lib/python${_pybasever}/"
+  # FS#33954
+  ln -sf python-${_pybasever}.pc    "${pkgdir}"/usr/lib/pkgconfig/python2.pc
+
+  ln -sf ../../libpython${_pybasever}.so "${pkgdir}"/usr/lib/python${_pybasever}/config/libpython${_pybasever}.so
+
+  mv "${pkgdir}"/usr/bin/smtpd.py "${pkgdir}"/usr/lib/python${_pybasever}/
 
   # some useful "stuff"
   install -dm755 "${pkgdir}"/usr/lib/python${_pybasever}/Tools/{i18n,scripts}
-  install -m755 Tools/i18n/{msgfmt,pygettext}.py \
-    "${pkgdir}/usr/lib/python${_pybasever}/Tools/i18n/"
-  install -m755 Tools/scripts/{README,*py} \
-    "${pkgdir}/usr/lib/python${_pybasever}/Tools/scripts/"
+  install -m755 Tools/i18n/{msgfmt,pygettext}.py "${pkgdir}"/usr/lib/python${_pybasever}/Tools/i18n/
+  install -m755 Tools/scripts/{README,*py} "${pkgdir}"/usr/lib/python${_pybasever}/Tools/scripts/
 
   # fix conflicts with python
   mv "${pkgdir}"/usr/bin/idle{,2}
   mv "${pkgdir}"/usr/bin/pydoc{,2}
   mv "${pkgdir}"/usr/bin/2to3{,-2.7}
 
-  # clean up #!s
-  find "${pkgdir}/usr/lib/python${_pybasever}/" -name '*.py' | \
-    xargs sed -i "s|#[ ]*![ ]*/usr/bin/env python$|#!/usr/bin/env python2|"
-
   # clean-up reference to build directory
-  sed -i "s#${srcdir}/Python-${pkgver}:##" \
-    "${pkgdir}/usr/lib/python${_pybasever}/config/Makefile"
+  sed -i "s#${srcdir}/Python-${pkgver}:##" "${pkgdir}"/usr/lib/python${_pybasever}/config/Makefile
 
   # license
-  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
+  install -Dm644 LICENSE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
 }
diff --git a/abs/core/python2/__changelog b/abs/core/python2/__changelog
index 59380ff..d8cc127 100644
--- a/abs/core/python2/__changelog
+++ b/abs/core/python2/__changelog
@@ -1 +1 @@
-add symlink making python2->python
+PKGBUILD: add symlink making python2->python
-- 
cgit v0.12