Skip to content
This repository was archived by the owner on Jan 15, 2020. It is now read-only.

New C extension backend #58

Closed
wants to merge 13 commits into from
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
*.pyc
.tox
ijson.egg-info
*.so
build
16 changes: 14 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,21 @@ language: python
python:
- "2.7"
- "3.4"
- "3.5"
- "3.6"
# yajl2 is not available in Ubuntu precise, let's build it
before_install:
- pip install cffi
- sudo apt-get update -qq
- sudo apt-get install -y libyajl1
- sudo apt-get install -y wget unzip
- wget https://github.com/lloyd/yajl/archive/2.1.0.zip
- unzip 2.1.0.zip
- cd yajl-2.1.0
- ./configure -p /usr && make all && sudo make install
install:
- cd ${TRAVIS_BUILD_DIR}
- pip install .
script: python tests.py
script:
- cd ..
- cp ${TRAVIS_BUILD_DIR}/tests.py .
- python tests.py
5 changes: 4 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,11 @@ Backends
Ijson provides several implementations of the actual parsing in the form of
backends located in ijson/backends:

- ``yajl2_c``: a C extension using `YAJL <http://lloyd.github.com/yajl/>`_ 2.x.
This is the fastest, but requires a compiler and the YAJL development files
to be present when installing this package.
- ``yajl2_cffi``: wrapper around `YAJL <http://lloyd.github.com/yajl/>`_ 2.x
using CFFI, this is the fastest.
using CFFI.
- ``yajl2``: wrapper around YAJL 2.x using ctypes, for when you can't use CFFI
for some reason.
- ``yajl``: deprecated YAJL 1.x + ctypes wrapper, for even older systems.
Expand Down
5 changes: 4 additions & 1 deletion ijson/backends/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ def find_yajl_ctypes(required):
so_name = util.find_library('yajl')
if so_name is None:
raise YAJLImportError('YAJL shared object not found.')
yajl = cdll.LoadLibrary(so_name)
try:
yajl = cdll.LoadLibrary(so_name)
except OSError:
raise YAJLImportError('Unable to load YAJL.')
require_version(yajl.yajl_version(), required)
return yajl

Expand Down
Loading