From f96a7e128d740eaebf067fe55aaff0cb0161be7c Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Thu, 1 Mar 2018 16:21:37 +0000
Subject: python2-pygments: update to 2.2.0

---
 abs/core/python_modules/python-pygments/PKGBUILD   | 63 ++++++++++++----------
 .../python_modules/python-pygments/__changelog     |  1 -
 .../python-pygments/python-pygments.install        |  7 ---
 .../python-pygments/python2-pygments.install       |  7 +++
 4 files changed, 42 insertions(+), 36 deletions(-)
 delete mode 100644 abs/core/python_modules/python-pygments/__changelog
 delete mode 100644 abs/core/python_modules/python-pygments/python-pygments.install
 create mode 100644 abs/core/python_modules/python-pygments/python2-pygments.install

diff --git a/abs/core/python_modules/python-pygments/PKGBUILD b/abs/core/python_modules/python-pygments/PKGBUILD
index fa1e572..37fe169 100644
--- a/abs/core/python_modules/python-pygments/PKGBUILD
+++ b/abs/core/python_modules/python-pygments/PKGBUILD
@@ -2,51 +2,58 @@
 # Maintainer: Evangelos Foutras <evangelos@foutrelis.com>
 # Contributor: Timm Preetz <timm@preetz.us>
 
-pkgname=('python2-pygments')
-pkgver=1.6
-pkgrel=3
+pkgname=('python-pygments' 'python2-pygments' 'pygmentize')
+pkgver=2.2.0
+pkgrel=1
 pkgdesc="Python syntax highlighter"
 arch=('any')
 url="http://pygments.org/"
 license=('BSD')
-makedepends=('python2-setuptools')
+makedepends=('python-setuptools' 'python2-setuptools')
 options=('!emptydirs')
-source=(http://pypi.python.org/packages/source/P/Pygments/Pygments-$pkgver.tar.gz)
-sha256sums=('799ed4caf77516e54440806d8d9cd82a7607dfdf4e4fb643815171a4b5c921c0')
-
-build() {
-  cd "$srcdir"
-
-  rm -rf python{2,3}-build
-  for builddir in python2-build; do
-    cp -r Pygments-$pkgver $builddir
-    pushd $builddir
-    ${builddir%-build} setup.py build
-    popd
-  done
-}
+source=(https://pypi.org/packages/source/P/Pygments/Pygments-$pkgver.tar.gz)
+sha256sums=('dbae1046def0efb574852fab9e90209b23f556367b5a320c0bcb871c77c3e8cc')
 
-#package_python-pygments() {
-#  depends=('python-setuptools')
-#  install=python-pygments.install
+package_python-pygments() {
+  depends=('python-setuptools')
 
-#  cd "$srcdir/python3-build"
+  cd "$srcdir/Pygments-$pkgver"
 
-#  python3 setup.py install --root="$pkgdir" -O1
+  python3 setup.py install --root="$pkgdir" -O1
 
-  # pygmentize has been moved to the python2-pygments package
-#  rm "$pkgdir/usr/bin/pygmentize"
+  # pygmentize is shipped in its own package
+  rm "$pkgdir/usr/bin/pygmentize"
 
-#  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
-#}
+  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+}
 
 package_python2-pygments() {
   depends=('python2-setuptools')
+  install=python2-pygments.install
 
-  cd "$srcdir/python2-build"
+  cd "$srcdir/Pygments-$pkgver"
 
   python2 setup.py install --root="$pkgdir" -O1
 
+  # pygmentize is shipped in its own package
+  rm "$pkgdir/usr/bin/pygmentize"
+
+  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+}
+
+package_pygmentize() {
+  depends=('python-pygments')
+
+  cd "$srcdir/Pygments-$pkgver"
+
+  python3 setup.py install --root="$pkgdir" -O1
+
+  # Remove all files except for usr/bin/pygmentize
+  find "$pkgdir" -type f -not -name pygmentize -delete
+
+  # Drop version dependency from console script
+  sed -i "s/Pygments==$pkgver/Pygments/g" "$pkgdir/usr/bin/pygmentize"
+
   install -Dm644 external/pygments.bashcomp \
     "$pkgdir/usr/share/bash-completion/completions/pygmentize"
 
diff --git a/abs/core/python_modules/python-pygments/__changelog b/abs/core/python_modules/python-pygments/__changelog
deleted file mode 100644
index 488d3cf..0000000
--- a/abs/core/python_modules/python-pygments/__changelog
+++ /dev/null
@@ -1 +0,0 @@
-PKGBUILD: rm py 3 stuff
diff --git a/abs/core/python_modules/python-pygments/python-pygments.install b/abs/core/python_modules/python-pygments/python-pygments.install
deleted file mode 100644
index eab5811..0000000
--- a/abs/core/python_modules/python-pygments/python-pygments.install
+++ /dev/null
@@ -1,7 +0,0 @@
-post_upgrade() {
-  if (($(vercmp $2 1.4-5) < 0)); then
-    echo '/usr/bin/pygmentize has been moved to the python2-pygments package'
-  fi
-}
-
-# vim:set ts=2 sw=2 et:
diff --git a/abs/core/python_modules/python-pygments/python2-pygments.install b/abs/core/python_modules/python-pygments/python2-pygments.install
new file mode 100644
index 0000000..3949246
--- /dev/null
+++ b/abs/core/python_modules/python-pygments/python2-pygments.install
@@ -0,0 +1,7 @@
+post_upgrade() {
+  if (($(vercmp $2 2.0.2-2) < 0)); then
+    echo ':: /usr/bin/pygmentize has been moved to the pygmentize package'
+  fi
+}
+
+# vim:set ts=2 sw=2 et:
-- 
cgit v0.12

