diff --git a/.travis.yml b/.travis.yml index 5b1d7a1..86a1b31 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,29 +1,54 @@ +sudo: false language: python -python: - - "2.7" -env: - - DJANGO_VERSION=1.6 - - DJANGO_VERSION=1.7 - - DJANGO_VERSION=1.8 +matrix: + include: + - python: 3.3 + env: DJANGO_VERSION=1.6 XAPIAN_VERSION=1.3.3 + - python: 3.3 + env: DJANGO_VERSION=1.7 XAPIAN_VERSION=1.3.3 + - python: 3.3 + env: DJANGO_VERSION=1.8 XAPIAN_VERSION=1.3.3 + - python: 2.7 + env: DJANGO_VERSION=1.6 XAPIAN_VERSION=1.3.3 + - python: 2.7 + env: DJANGO_VERSION=1.7 XAPIAN_VERSION=1.3.3 + - python: 2.7 + env: DJANGO_VERSION=1.8 XAPIAN_VERSION=1.3.3 + - python: 2.7 + env: DJANGO_VERSION=1.6 XAPIAN_VERSION=1.2.19 + - python: 2.7 + env: DJANGO_VERSION=1.7 XAPIAN_VERSION=1.2.19 + - python: 2.7 + env: DJANGO_VERSION=1.8 XAPIAN_VERSION=1.2.19 + +addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + # Xapian requires uuid-dev, Xapian ==1.3.3 requires compilers with c++11. + - uuid-dev + - gcc-4.8 + - g++-4.8 -# command to install dependencies install: + # install Xapian + - CXX=g++-4.8 ./install_xapian.sh $XAPIAN_VERSION + - pip install Django==$DJANGO_VERSION - - cd .. - - git clone https://github.com/toastdriven/django-haystack.git - - sudo apt-get install -qq libxapian22 xapian-tools python-xapian - - ln -s /usr/lib/python2.7/dist-packages/xapian $VIRTUAL_ENV/lib/python2.7/site-packages/. - pip install coveralls -# move xapian-haystack to django-haystack -before_script: + # install Django haystack + - cd .. # move from xapian-haystack + - git clone https://github.com/toastdriven/django-haystack.git + + # cp xapian-haystack to django-haystack - cp xapian-haystack/xapian_backend.py django-haystack/haystack/backends - cp -r xapian-haystack/tests/* django-haystack/test_haystack/ - cp xapian-haystack/tests/xapian_tests/__init__.py django-haystack/test_haystack/ - cp xapian-haystack/.coveragerc django-haystack/ -# command to run tests script: - cd django-haystack/ - PYTHONPATH=`pwd` coverage run `which django-admin.py` test test_haystack.xapian_tests --settings=test_haystack.xapian_settings diff --git a/README.rst b/README.rst index 66d205b..ec8ecee 100644 --- a/README.rst +++ b/README.rst @@ -30,17 +30,17 @@ Xapian-Haystack provides all the standard features of Haystack: Requirements ------------ -- Python 2.4+ (Python 3.3 not support `yet `_). +- Python 2.7 or 3.3 - Django 1.6+ -- Django-Haystack 2.0.X -- Xapian 1.0.13+ +- Django-Haystack 2 +- Xapian 1.2.13+ In particular, we build this backend on `Travis`_ using: -- Python 2.7.6 +- Python 2.7 and 3.3 - Django 1.6, 1.7 and 1.8 - Django-Haystack (master) -- Xapian 1.2.8 (libxapian22) +- Xapian 1.2.21 and 1.3.3 Installation diff --git a/install_xapian.sh b/install_xapian.sh new file mode 100755 index 0000000..586b19c --- /dev/null +++ b/install_xapian.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +# first argument of the script is Xapian version (e.g. 1.2.19) +VERSION=$1 + +# prepare +mkdir $VIRTUAL_ENV/packages && cd $VIRTUAL_ENV/packages + +CORE=xapian-core-$VERSION +BINDINGS=xapian-bindings-$VERSION + +# download +echo "Downloading source..." +curl -O http://oligarchy.co.uk/xapian/$VERSION/${CORE}.tar.xz +curl -O http://oligarchy.co.uk/xapian/$VERSION/${BINDINGS}.tar.xz + +# extract +echo "Extracting source..." +tar xf ${CORE}.tar.xz +tar xf ${BINDINGS}.tar.xz + +# install +echo "Installing Xapian-core..." +cd $VIRTUAL_ENV/packages/${CORE} +./configure --prefix=$VIRTUAL_ENV && make && make install + +PYV=`python -c "import sys;t='{v[0]}'.format(v=list(sys.version_info[:1]));sys.stdout.write(t)";` + +if [ $PYV = "2" ]; then + PYTHON_FLAG=--with-python +else + PYTHON_FLAG=--with-python3 +fi + +if [ $VERSION = "1.3.3" ]; then + XAPIAN_CONFIG=$VIRTUAL_ENV/bin/xapian-config-1.3 +else + XAPIAN_CONFIG= +fi + +echo "Installing Xapian-bindings..." +cd $VIRTUAL_ENV/packages/${BINDINGS} +./configure --prefix=$VIRTUAL_ENV $PYTHON_FLAG XAPIAN_CONFIG=$XAPIAN_CONFIG && make && make install + +# clean +rm -rf $VIRTUAL_ENV/packages + +# test +python -c "import xapian"