From e3b7e82ffe35aca4fbeb295f21292fedf29514cc Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Sun, 4 Mar 2018 20:38:59 +0000
Subject: python-lxml: update to 4.1.1

---
 abs/core/python_modules/python-lxml/PKGBUILD    | 103 +++++++++++++++++-------
 abs/core/python_modules/python-lxml/__changelog |   1 -
 2 files changed, 76 insertions(+), 28 deletions(-)
 delete mode 100644 abs/core/python_modules/python-lxml/__changelog

diff --git a/abs/core/python_modules/python-lxml/PKGBUILD b/abs/core/python_modules/python-lxml/PKGBUILD
index e12b716..bfb65bf 100644
--- a/abs/core/python_modules/python-lxml/PKGBUILD
+++ b/abs/core/python_modules/python-lxml/PKGBUILD
@@ -1,49 +1,98 @@
-# $Id: PKGBUILD 162858 2012-07-02 13:06:22Z giovanni $
-# Maintainer:
-
-pkgname=('python2-lxml')
-pkgver=2.3.4
-pkgrel=2
-pkgdesc="Python binding for the libxml2 and libxslt libraries"
-arch=('i686' 'x86_64')
+# $Id$
+# Maintainer: Angel Velasquez <angvp@archlinux.org>
+# Maintainer: Felix Yan <felixonmars@archlinux.org>
+
+pkgbase=python-lxml
+pkgname=('python-lxml' 'python2-lxml' 'python-lxml-docs')
+pkgver=4.1.1
+pkgrel=1
+arch=('x86_64')
 license=('BSD' 'custom')
 url="http://lxml.de/"
-makedepends=('python2' 'libxslt')
-source=(http://pypi.python.org/packages/source/l/lxml/lxml-${pkgver}.tar.gz{,.asc})
-sha1sums=('90a226d8a2ee38de47fc3351445dab6df0e33a20'
-          '7962be7794d7f4c87d2fce0104c27990f48f1ce1')
+makedepends=('libxslt' 'python-setuptools' 'python2-setuptools' 'epydoc' 'python2-pygments'
+             'python2-docutils' 'cython' 'cython2')
+checkdepends=('python-cssselect' 'python2-cssselect' 'python-html5lib' 'python2-html5lib'
+              'python-beautifulsoup4' 'python2-beautifulsoup4')
+source=("https://github.com/lxml/lxml/archive/lxml-$pkgver.tar.gz")
+sha512sums=('69c64fc9f34bd8250dffcc32b6dcc93490731cd32778d7257a232fc5a126e74433ce6d4351683b71872cbeccd2c4d5a970e8fc2e631bbc273125be2b7f61ef31')
+
+prepare() {
+  mv lxml-lxml-$pkgver lxml-$pkgver
+  cp -a lxml-$pkgver{,-py2}
+
+  # Setting LC_CTYPE to workaround encoding issue
+  export LC_CTYPE=en_US.UTF-8
+}
+
+build() {
+  cd "$srcdir"/lxml-$pkgver
+  python setup.py build
+
+  cd "$srcdir"/lxml-$pkgver-py2
+  python2 setup.py build
+  make PYTHON=python2 html
+}
 
 check() {
-  cd "${srcdir}"/lxml-$pkgver
+  # TODO: Find a sane way to skip inplace build
+
+  cd "$srcdir"/lxml-$pkgver
+  make PYTHON=python test
+
+  cd "$srcdir"/lxml-$pkgver-py2
   make PYTHON=python2 test
-  #make PYTHON=python test
+}
+
+package_python-lxml() {
+  pkgdesc="Python3 binding for the libxml2 and libxslt libraries"
+  depends=('python' 'libxslt')
+  optdepends=('python-beautifulsoup4: support for beautifulsoup parser to parse not well formed HTML'
+              'python-cssselect: support for cssselect'
+              'python-html5lib: support for html5lib parser'
+              'python-lxml-docs: offline docs')
+
+  cd lxml-$pkgver
+  python setup.py install --root="$pkgdir" --skip-build --optimize=1
+
+  install -Dm644 LICENSES.txt \
+    "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
+  install -Dm644 doc/licenses/BSD.txt \
+    "$pkgdir"/usr/share/licenses/$pkgname/BSD.txt
+  install -Dm644 doc/licenses/elementtree.txt \
+    "$pkgdir"/usr/share/licenses/$pkgname/elementtree.txt
 }
 
 package_python2-lxml() {
+  pkgdesc="Python2 binding for the libxml2 and libxslt libraries"
   depends=('python2' 'libxslt')
-  optdepends=('python2-beautifulsoup3: support for parsing not well formed HTML')
+  optdepends=('python2-beautifulsoup4: support for beautifulsoup parser to parse not well formed HTML'
+              'python2-cssselect: support for cssselect'
+              'python2-html5lib: support for html5lib parser'
+              'python-lxml-docs: offline docs')
 
-  cd "${srcdir}"/lxml-$pkgver
-  python2 setup.py install --root="${pkgdir}" --optimize=1
+  cd lxml-$pkgver-py2
+  python2 setup.py install --root="$pkgdir" --skip-build --optimize=1
 
   install -Dm644 LICENSES.txt \
-    "${pkgdir}"/usr/share/licenses/$pkgname/LICENSE
+    "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
   install -Dm644 doc/licenses/BSD.txt \
-    "${pkgdir}"/usr/share/licenses/$pkgname/BSD.txt
+    "$pkgdir"/usr/share/licenses/$pkgname/BSD.txt
   install -Dm644 doc/licenses/elementtree.txt \
-    "${pkgdir}"/usr/share/licenses/$pkgname/elementtree.txt
+    "$pkgdir"/usr/share/licenses/$pkgname/elementtree.txt
 }
 
-package_python-lxml() {
-  depends=('python' 'libxslt')
+package_python-lxml-docs() {
+  pkgdesc="Python binding for the libxml2 and libxslt libraries (docs)"
+  options=('docs')
 
-  cd "${srcdir}"/lxml-$pkgver
-  python setup.py install --root="${pkgdir}" --optimize=1
+  cd lxml-$pkgver-py2
+  install -d "$pkgdir"/usr/share/doc/$pkgbase
+  cp -r doc/html "$pkgdir"/usr/share/doc/$pkgbase
 
   install -Dm644 LICENSES.txt \
-    "${pkgdir}"/usr/share/licenses/$pkgname/LICENSE
+    "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
   install -Dm644 doc/licenses/BSD.txt \
-    "${pkgdir}"/usr/share/licenses/$pkgname/BSD.txt
+    "$pkgdir"/usr/share/licenses/$pkgname/BSD.txt
   install -Dm644 doc/licenses/elementtree.txt \
-    "${pkgdir}"/usr/share/licenses/$pkgname/elementtree.txt
+    "$pkgdir"/usr/share/licenses/$pkgname/elementtree.txt
 }
diff --git a/abs/core/python_modules/python-lxml/__changelog b/abs/core/python_modules/python-lxml/__changelog
deleted file mode 100644
index 9731eb3..0000000
--- a/abs/core/python_modules/python-lxml/__changelog
+++ /dev/null
@@ -1 +0,0 @@
-removed python3
-- 
cgit v0.12

