From d478c239a70be9bc826b0c969d10215224ef26bc Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 6 Jul 2014 22:49:47 +0400 Subject: [PATCH 1/4] Enable pypy tests in .travis.yml --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 14195f22..4eccbf31 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ python: - "3.2" - "3.3" - "3.4" + - "pypy" install: tests/install.sh script: tests/test.sh From 6c0018b7a3141ca616dabc1fc46a209eb34fbb13 Mon Sep 17 00:00:00 2001 From: ZyX Date: Thu, 10 Jul 2014 19:16:27 +0400 Subject: [PATCH 2/4] Purge use_errno argument from function prototype calls - It is already contained in prototype definition. - PyPy is not able to run code with use_errno there. --- powerline/lib/inotify.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/powerline/lib/inotify.py b/powerline/lib/inotify.py index 0e8211eb..c2b25444 100644 --- a/powerline/lib/inotify.py +++ b/powerline/lib/inotify.py @@ -46,17 +46,17 @@ def load_inotify(): # inotify_add_watch() prototype = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_int, ctypes.c_char_p, ctypes.c_uint32, use_errno=True) add_watch = prototype(('inotify_add_watch', libc), ( - (1, "fd"), (1, "pathname"), (1, "mask")), use_errno=True) + (1, "fd"), (1, "pathname"), (1, "mask"))) # inotify_rm_watch() prototype = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_int, ctypes.c_int, use_errno=True) rm_watch = prototype(('inotify_rm_watch', libc), ( - (1, "fd"), (1, "wd")), use_errno=True) + (1, "fd"), (1, "wd"))) # read() prototype = ctypes.CFUNCTYPE(ctypes.c_ssize_t, ctypes.c_int, ctypes.c_void_p, ctypes.c_size_t, use_errno=True) read = prototype(('read', libc), ( - (1, "fd"), (1, "buf"), (1, "count")), use_errno=True) + (1, "fd"), (1, "buf"), (1, "count"))) _inotify = (init1, add_watch, rm_watch, read) return _inotify From 19195159adc5ec0df35fc8cb7064c6f2f0b570f5 Mon Sep 17 00:00:00 2001 From: ZyX Date: Thu, 10 Jul 2014 19:29:56 +0400 Subject: [PATCH 3/4] Only install mercurial and bazaar if using CPython --- tests/install.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/install.sh b/tests/install.sh index 510e6a96..05d2e3d2 100755 --- a/tests/install.sh +++ b/tests/install.sh @@ -3,8 +3,10 @@ pip install . pip install psutil if python -c 'import sys; sys.exit(1 * (sys.version_info[0] != 2))' ; then # Python 2 - pip install mercurial - pip install --allow-external bzr --allow-unverified bzr bzr + if python -c 'import platform, sys; sys.exit(1 - (platform.python_implementation() == "CPython"))' ; then + pip install mercurial + pip install --allow-external bzr --allow-unverified bzr bzr + fi if python -c 'import sys; sys.exit(1 * (sys.version_info[1] >= 7))' ; then # Python 2.6 pip install unittest2 argparse From 871ce5727b1721abc1d48f9f9d2d7f6d9a5e7b30 Mon Sep 17 00:00:00 2001 From: ZyX Date: Thu, 10 Jul 2014 19:49:37 +0400 Subject: [PATCH 4/4] Set use_mercurial and use_bzr to False in PyPy --- tests/test_lib.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_lib.py b/tests/test_lib.py index c69d97b6..fa22da41 100644 --- a/tests/test_lib.py +++ b/tests/test_lib.py @@ -13,6 +13,7 @@ import threading import os import sys import re +import platform from time import sleep from subprocess import call, PIPE from functools import partial @@ -466,7 +467,8 @@ class TestFilesystemWatchers(TestCase): os.rename(f, f + '1') changed() -use_mercurial = use_bzr = sys.version_info < (3, 0) +use_mercurial = use_bzr = (sys.version_info < (3, 0) + and platform.python_implementation() == 'CPython') class TestVCS(TestCase):