diff --git a/.travis.yml b/.travis.yml index 8e6f3a4..10113ed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,11 +20,13 @@ matrix: - env: - DIST=ubuntu - VERSION=16.04 + - env: + - DIST=quay.io/pypa/manylinux2010_x86_64 + - VERSION=latest before_install: - docker pull ${DIST}:${VERSION} - - docker run -w /root --name test -d ${DIST}:${VERSION} sleep infinity - - docker cp . test:/root/ + - docker run -v $(pwd):/io -w /io --name test -d ${DIST}:${VERSION} sleep infinity - if [ "$DIST" == "centos" ]; then if [ $VERSION -eq 6 ]; then docker exec test rpm -Uvh http://download.jubat.us/yum/rhel/6/stable/x86_64/jubatus-release-6-2.el6.x86_64.rpm; @@ -61,20 +63,18 @@ install: fi; fi - if [ "$DIST" == "centos" ] && [ $VERSION -eq 6 ]; then - docker exec test /usr/bin/scl enable python27 -- pip install --upgrade pip setuptools; - else - docker exec test pip install --upgrade pip setuptools; + docker exec test /usr/bin/scl enable python27 -- pip install --upgrade pip setuptools cython; + elif [ "$DIST" != "quay.io/pypa/manylinux2010_x86_64" ]; then + docker exec test pip install --upgrade pip setuptools cython; fi - if [ "$TRAVIS_BRANCH" != "master" ]; then if [ "$DIST" == "centos" ]; then docker exec test yum -y install git bzip2 msgpack-devel-0.5.9; - elif [ "$DIST" == "ubuntu" ]; then - docker exec test apt-get --force-yes -y install git bzip2 libmsgpack-dev; - fi; - docker exec test git clone -b develop https://github.com/jubatus/jubatus_core.git; - if [ "$DIST" == "centos" ]; then + docker exec test git clone -b develop https://github.com/jubatus/jubatus_core.git; docker exec test bash -ic "cd jubatus_core; ./waf configure --prefix=/usr --regexp-library=none && ./waf build && ./waf install && ldconfig"; elif [ "$DIST" == "ubuntu" ]; then + docker exec test apt-get --force-yes -y install git bzip2 libmsgpack-dev; + docker exec test git clone -b develop https://github.com/jubatus/jubatus_core.git; docker exec test bash -ic "cd jubatus_core; ./waf configure --prefix=/usr --regexp-library=none && ./waf build && ./waf install"; fi; fi @@ -82,10 +82,12 @@ install: script: - if [ "$DIST" == "centos" ]; then if [ $VERSION -eq 6 ]; then - docker exec -t test /usr/bin/scl enable python27 -- bash -ic "pip install -e . && pip install scipy && python ./setup.py test"; + docker exec -t test /usr/bin/scl enable python27 -- bash -ic "pip install -r requirements.txt && pip install -e . && pip install scipy && python ./setup.py test"; else - docker exec -t test bash -ic "pip install -e . && pip install scipy && python ./setup.py test"; + docker exec -t test bash -ic "pip install -r requirements.txt && pip install -e . && pip install scipy && python ./setup.py test"; fi; elif [ "$DIST" == "ubuntu" ]; then - docker exec -t test bash -ic "source /opt/jubatus/profile; pip install -e . && pip install scipy && python ./setup.py test"; - fi \ No newline at end of file + docker exec -t test bash -ic "source /opt/jubatus/profile; pip install -r requirements.txt && pip install -e . && pip install scipy && python ./setup.py test"; + elif [ "$DIST" == "quay.io/pypa/manylinux2010_x86_64" ]; then + docker exec -t test bash build-wheels.sh build_wheels; + fi diff --git a/README.rst b/README.rst index a3cc098..f9fed43 100644 --- a/README.rst +++ b/README.rst @@ -19,14 +19,16 @@ Install :: - pip install Cython pip install embedded_jubatus Requirements ------------ -* Python 2.7, 3.3, 3.4 or 3.5. -* `Jubatus `_ needs to be installed. +* Python 2.7, 3.5, 3.6 or 3.7 +* `Jubatus (Python Client) `_ 1.0.2 or later +* numpy 1.14-1.16 (1.17 or later don't support Python 2.7) +* `Jubatus `_ needs to be installed when build from source package or repository +* `Cython `_ needs to be installed when build from repository Limitations ----------- diff --git a/VERSION b/VERSION index 0c39c61..7b1329e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.1.1-p1 +1.1.1.post2 diff --git a/build-wheels.sh b/build-wheels.sh new file mode 100755 index 0000000..2ada946 --- /dev/null +++ b/build-wheels.sh @@ -0,0 +1,51 @@ +#!/bin/bash +set -e -x + +function build_wheels() { + if [ -z "${JUBATUS_VERSION}" ]; then + JUBATUS_VERSION=${TRAVIS_TAG:-master} + fi + + rpm -Uvh http://download.jubat.us/yum/rhel/6/stable/x86_64/jubatus-release-6-2.el6.x86_64.rpm + yum install -y msgpack-devel oniguruma-devel + + curl -OL https://github.com/jubatus/jubatus_core/archive/${JUBATUS_VERSION}.tar.gz + tar xf ${JUBATUS_VERSION}.tar.gz + cd jubatus_core-${JUBATUS_VERSION} + ./waf configure --prefix=/usr + ./waf build + ./waf install + cd /io + + for PYBIN in /opt/python/*/bin; do + "${PYBIN}/pip" install cython + "${PYBIN}/pip" install -r /io/requirements.txt + "${PYBIN}/pip" wheel /io/ -w wheelhouse/ + done + + for whl in wheelhouse/*.whl; do + auditwheel repair "$whl" --plat manylinux2010_x86_64 -w /io/wheelhouse/ + done + + /opt/python/cp37-cp37m/bin/python ./setup.py sdist + + cd /io/tests + for PYBIN in /opt/python/*/bin; do + V=${PYBIN%/bin} + V=${V#/opt/python/} + "${PYBIN}/pip" install /io/wheelhouse/embedded_jubatus-*-${V}-manylinux2010_x86_64.whl scipy + "${PYBIN}/python" -m unittest discover -v + done +} + +if [ "$1" = "build_wheels" ]; then + build_wheels +else + docker pull quay.io/pypa/manylinux2010_x86_64 + docker run --rm \ + -e JUBATUS_VERSION=${JUBATUS_VERSION} \ + -e TRAVIS_TAG=${TRAVIS_TAG} \ + -v $(pwd):/io \ + quay.io/pypa/manylinux2010_x86_64 \ + /io/build-wheels.sh build_wheels +fi diff --git a/requirements.txt b/requirements.txt index 7713793..bfcb1ee 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,2 @@ -Cython>=0.27 -numpy>=1.14 +numpy>=1.16 jubatus>=1.0.2 diff --git a/setup.py b/setup.py index a571ce8..4acc001 100644 --- a/setup.py +++ b/setup.py @@ -13,9 +13,8 @@ def read(name): def _setup(): include_dirs = [] install_requires = read('requirements.txt').split('\n') - build_requires = [ - line for line in install_requires - if line.startswith('numpy') or line.startswith('Cython')] + setup_requires = ['Cython'] + [ + row for row in install_requires if row.startswith('numpy')] try: from Cython.Build import cythonize @@ -51,24 +50,24 @@ def _setup(): 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 3', ], - build_requires=build_requires, + setup_requires=setup_requires, install_requires=install_requires, test_suite='tests', ) + kwargs['ext_modules'] = [Extension( + 'embedded_jubatus', [ + 'src/embedded_jubatus.{}'.format( + 'pyx' if cythonize else 'cpp'), + 'src/_wrapper.cpp', + 'src/_model.cpp' + ], + include_dirs=include_dirs, + libraries=['jubatus_core', 'jubatus_util_text'], + language='c++', + extra_compile_args=extra_compile_args) + ] if cythonize: - kwargs['ext_modules'] = cythonize([ - Extension( - 'embedded_jubatus', - [ - 'src/embedded_jubatus.pyx', - 'src/_wrapper.cpp', - 'src/_model.cpp' - ], - include_dirs=include_dirs, - libraries=['jubatus_core', 'jubatus_util_text'], - language='c++', - extra_compile_args=extra_compile_args) - ]) + kwargs['ext_modules'] = cythonize(kwargs['ext_modules']) setup(**kwargs)