[arch-commits] Commit in python-pygments/trunk (2 files)

Evangelos Foutras foutrelis at nymeria.archlinux.org
Wed Jul 2 15:02:15 UTC 2014


    Date: Wednesday, July 2, 2014 @ 17:02:15
  Author: foutrelis
Revision: 114649

upgpkg: python-pygments 1.6-4

Fix FS#40547: python3 compatibility

Added:
  python-pygments/trunk/make-pygments.lexers.guess_lexer_for_filename-py3-compatible.patch
Modified:
  python-pygments/trunk/PKGBUILD

--------------------------------------------------------------------+
 PKGBUILD                                                           |   14 +++-
 make-pygments.lexers.guess_lexer_for_filename-py3-compatible.patch |   29 ++++++++++
 2 files changed, 40 insertions(+), 3 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2014-07-02 14:54:20 UTC (rev 114648)
+++ PKGBUILD	2014-07-02 15:02:15 UTC (rev 114649)
@@ -4,7 +4,7 @@
 
 pkgname=('python-pygments' 'python2-pygments')
 pkgver=1.6
-pkgrel=3
+pkgrel=4
 pkgdesc="Python syntax highlighter"
 arch=('any')
 url="http://pygments.org/"
@@ -11,9 +11,17 @@
 license=('BSD')
 makedepends=('python-setuptools' 'python2-setuptools')
 options=('!emptydirs')
-source=(http://pypi.python.org/packages/source/P/Pygments/Pygments-$pkgver.tar.gz)
-sha256sums=('799ed4caf77516e54440806d8d9cd82a7607dfdf4e4fb643815171a4b5c921c0')
+source=(https://pypi.python.org/packages/source/P/Pygments/Pygments-$pkgver.tar.gz
+        make-pygments.lexers.guess_lexer_for_filename-py3-compatible.patch)
+sha256sums=('799ed4caf77516e54440806d8d9cd82a7607dfdf4e4fb643815171a4b5c921c0'
+            '15cf8323ce343d32cbf78d35ab20001ce3204abe90b68a80607c7aea41499f07')
 
+prepare() {
+  cd "$srcdir/Pygments-$pkgver"
+
+  patch -Np1 -i "$srcdir/make-pygments.lexers.guess_lexer_for_filename-py3-compatible.patch"
+}
+
 build() {
   cd "$srcdir"
 

Added: make-pygments.lexers.guess_lexer_for_filename-py3-compatible.patch
===================================================================
--- make-pygments.lexers.guess_lexer_for_filename-py3-compatible.patch	                        (rev 0)
+++ make-pygments.lexers.guess_lexer_for_filename-py3-compatible.patch	2014-07-02 15:02:15 UTC (rev 114649)
@@ -0,0 +1,29 @@
+# HG changeset patch
+# User goodwillcoding <goodwillcoding at webhippo.net>
+# Date 1376769053 25200
+# Node ID c31841d2fd2171419134f30e815dcafb1e8c7eee
+# Parent  7304e4759ae65343d89a51359ca538912519cc31
+Make pygments.lexers.guess_lexer_for_filename py3 compatible.
+Background:
+In py3 one can longer sort classes by class names
+the fix addes a custome sorting function that works
+the same in py2 and py3
+
+diff --git a/pygments/lexers/__init__.py b/pygments/lexers/__init__.py
+--- a/pygments/lexers/__init__.py
++++ b/pygments/lexers/__init__.py
+@@ -188,7 +188,13 @@
+         if rv == 1.0:
+             return lexer(**options)
+         result.append((rv, lexer))
+-    result.sort()
++
++    # since py3 can no longer sort by class name by default, here is the
++    # sorting function that works in both
++    def type_sort(type_):
++        return (type_[0], type_[1].__name__)
++    result.sort(key=type_sort)
++
+     if not result[-1][0] and primary is not None:
+         return primary(**options)
+     return result[-1][1](**options)




More information about the arch-commits mailing list