[arch-commits] Commit in python-sure/repos (3 files)

Felix Yan fyan at archlinux.org
Wed Apr 15 06:09:28 UTC 2015


    Date: Wednesday, April 15, 2015 @ 08:09:27
  Author: fyan
Revision: 131388

archrelease: copy trunk to community-testing-any

Added:
  python-sure/repos/community-testing-any/
  python-sure/repos/community-testing-any/PKGBUILD
    (from rev 131387, python-sure/trunk/PKGBUILD)
  python-sure/repos/community-testing-any/py3k-fix.patch
    (from rev 131387, python-sure/trunk/py3k-fix.patch)

----------------+
 PKGBUILD       |   47 ++++++++++++++++++++++++++++++++++
 py3k-fix.patch |   74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 121 insertions(+)

Copied: python-sure/repos/community-testing-any/PKGBUILD (from rev 131387, python-sure/trunk/PKGBUILD)
===================================================================
--- community-testing-any/PKGBUILD	                        (rev 0)
+++ community-testing-any/PKGBUILD	2015-04-15 06:09:27 UTC (rev 131388)
@@ -0,0 +1,47 @@
+# $Id$
+# Maintainer: Felix Yan <felixonmars at archlinux.org>
+
+pkgbase=python-sure
+pkgname=("python-sure" "python2-sure")
+pkgver=1.2.10
+pkgrel=1
+pkgdesc="HTTP client mock for Python"
+arch=('any')
+url="http://github.com/gabrielfalcao/sure"
+license=('GPL')
+makedepends=('python-six' 'python2-six' 'python-mock' 'python2-mock')
+checkdepends=('python-nose' 'python2-nose')
+source=("https://pypi.python.org/packages/source/s/sure/sure-$pkgver.tar.gz"
+        py3k-fix.patch)
+sha512sums=('9053cd493a26a9314db7e5967dd8ce8caebd110ba9b26ea077f5dc8d9d34ff7d7feb7bde9886420cd64d11e88574b44396fddbaaeaafc380244f2d48d59185d4'
+            '90118b3c3148b6dd6904f94199fc7ae98fc805980132000e270e1b80a563620a1216f916e82c894cfe8cd0c68041ca091ebd7c0a8e64b1cf6dd3c84db3b0d558')
+
+prepare() {
+  cp -a "sure-$pkgver"{,-py2}
+
+  cd sure-$pkgver
+  patch -p1 -i ../py3k-fix.patch
+}
+
+check() {
+  cd sure-$pkgver
+  nosetests3
+
+  cd ../sure-$pkgver-py2
+  nosetests2
+}
+
+package_python-sure() {
+  depends=('python-six' 'python-mock')
+
+  cd sure-$pkgver
+  LC_CTYPE=en_US.UTF-8 python3 setup.py install --root="${pkgdir}" --optimize=1
+}
+
+package_python2-sure() {
+  depends=('python2-six' 'python2-mock')
+
+  cd sure-$pkgver-py2
+  LC_CTYPE=en_US.UTF-8 python2 setup.py install --root="${pkgdir}" --optimize=1
+}
+

Copied: python-sure/repos/community-testing-any/py3k-fix.patch (from rev 131387, python-sure/trunk/py3k-fix.patch)
===================================================================
--- community-testing-any/py3k-fix.patch	                        (rev 0)
+++ community-testing-any/py3k-fix.patch	2015-04-15 06:09:27 UTC (rev 131388)
@@ -0,0 +1,74 @@
+From dfa565626a53c8902a7f108417281c95f8e1f241 Mon Sep 17 00:00:00 2001
+From: Timo Furrer <tuxtimo at gmail.com>
+Date: Thu, 11 Dec 2014 10:45:50 +0100
+Subject: [PATCH] make python 3 compatible again The function objects in python
+ 3 have no `func_code` member anymore. Use `__code__` instead. The byte
+ objects in python 3 have no `format` method. Use `encode` instead. The
+ representation of the strings and encoded strings are different in python 2
+ and python 3 thus use PY3 from six. Remove unlucky example from README since
+ python 3 returns a float and python 2 an int in this situation Python 2 and 3
+ build is working again
+
+---
+ README.md                       |  1 -
+ sure/old.py                     |  8 ++++----
+ tests/test_assertion_builder.py | 10 ++++++++--
+ 3 files changed, 12 insertions(+), 7 deletions(-)
+
+diff --git a/README.md b/README.md
+index 03d7e2f..5e09d57 100644
+--- a/README.md
++++ b/README.md
+@@ -32,7 +32,6 @@ import sure
+ 
+ (4).should.be.equal(2 + 2)
+ (7.5).should.eql(3.5 + 4)
+-(2).should.equal(8 / 4)
+ 
+ (3).shouldnt.be.equal(5)
+ ```
+diff --git a/sure/old.py b/sure/old.py
+index 70822e1..13a3f74 100644
+--- a/sure/old.py
++++ b/sure/old.py
+@@ -42,10 +42,10 @@
+ 
+ 
+ def identify_callable_location(callable_object):
+-    filename = os.path.relpath(callable_object.func_code.co_filename)
+-    lineno = callable_object.func_code.co_firstlineno
+-    callable_name = callable_object.func_code.co_name
+-    return b'{0} [{1} line {2}]'.format(callable_name, filename, lineno)
++    filename = os.path.relpath(callable_object.__code__.co_filename)
++    lineno = callable_object.__code__.co_firstlineno
++    callable_name = callable_object.__code__.co_name
++    return '{0} [{1} line {2}]'.format(callable_name, filename, lineno).encode()
+ 
+ 
+ def is_iterable(obj):
+diff --git a/tests/test_assertion_builder.py b/tests/test_assertion_builder.py
+index 6a58c1a..5b3d2de 100644
+--- a/tests/test_assertion_builder.py
++++ b/tests/test_assertion_builder.py
+@@ -648,13 +648,19 @@ def blah(num):
+         raise RuntimeError('should not have reached here')
+ 
+     except AssertionError as e:
+-        expect(str(e)).to.equal("When calling 'blah [tests/test_assertion_builder.py line 633]' the exception message does not match. Expected to match regex: u'invalid regex'\n against:\n u'this message'")
++        if PY3:
++            expect(str(e)).to.equal("When calling b'blah [tests/test_assertion_builder.py line 633]' the exception message does not match. Expected to match regex: 'invalid regex'\n against:\n 'this message'")
++        else:
++            expect(str(e)).to.equal("When calling 'blah [tests/test_assertion_builder.py line 633]' the exception message does not match. Expected to match regex: u'invalid regex'\n against:\n u'this message'")
+ 
+     try:
+         expect(blah).when.called_with(1).should.throw(ValueError, re.compile(r'invalid regex'))
+         raise RuntimeError('should not have reached here')
+     except AssertionError as e:
+-        expect(str(e)).to.equal("When calling 'blah [tests/test_assertion_builder.py line 633]' the exception message does not match. Expected to match regex: u'invalid regex'\n against:\n u'this message'")
++        if PY3:
++            expect(str(e)).to.equal("When calling b'blah [tests/test_assertion_builder.py line 633]' the exception message does not match. Expected to match regex: 'invalid regex'\n against:\n 'this message'")
++        else:
++            expect(str(e)).to.equal("When calling 'blah [tests/test_assertion_builder.py line 633]' the exception message does not match. Expected to match regex: u'invalid regex'\n against:\n u'this message'")
+ 
+ def test_should_not_be_different():
+     ("'something'.should_not.be.different('SOMETHING'.lower())")



More information about the arch-commits mailing list