diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000000000000000000000000000000000..d838cc4fd68163b8bbd3e1aeae42acf223b96b93 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,23 @@ +notifications: + email: false +if: tag IS present +matrix: + include: + - sudo: required + services: + - docker + env: + - DOCKER_IMAGE=quay.io/pypa/manylinux1_x86_64 + - sudo: required + services: + - docker + env: + - DOCKER_IMAGE=quay.io/pypa/manylinux1_i686 + - PRE_CMD=linux32 +install: + - docker pull $DOCKER_IMAGE +script: + - pwd + - ls -la + - docker run --rm -v `pwd`:/io -e TWINE_USERNAME -e TWINE_PASSWORD $DOCKER_IMAGE $PRE_CMD /io/travis/build-wheels.sh + - ls wheelhouse/ diff --git a/travis/build-wheels.sh b/travis/build-wheels.sh new file mode 100755 index 0000000000000000000000000000000000000000..d26aad2c8ed8af883221c5e1faf54404edc605b2 --- /dev/null +++ b/travis/build-wheels.sh @@ -0,0 +1,58 @@ +#!/bin/bash +set -e -x + +cd /io +mkdir -p deps +cd deps + +yum install -y git cmake yum wget +wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz +tar -xvf ruby-2.1.2.tar.gz +cd ruby-2.1.2 +./configure +make -j4 +make install +cd .. +rm -rf ruby-2.1.2 + +git clone --branch v2.2.12 https://github.com/OCL-dev/ocl-icd +cd ocl-icd +wget https://raw.githubusercontent.com/conda-forge/ocl-icd-feedstock/master/recipe/install-headers.patch --no-check-certificate +git apply install-headers.patch +autoreconf -i +chmod +x configure +./configure --prefix=/usr +make -j4 +make install + +cd /io + +# Compile wheels +for PYBIN in /opt/python/*/bin; do + "${PYBIN}/pip" install numpy pybind11 mako + "${PYBIN}/pip" wheel /io/ -w wheelhouse/ +done + +# Bundle external shared libraries into the wheels +for whl in wheelhouse/pyopencl*.whl; do + auditwheel repair "$whl" -w /io/wheelhouse/ +done + +# Bundle license files +/opt/python/cp37-cp37m/bin/pip install delocate +/opt/python/cp37-cp37m/bin/python /io/travis/fix-wheel.py /io/deps/ocl-icd/COPYING + +/opt/python/cp37-cp37m/bin/pip install twine +for WHEEL in /io/wheelhouse/pyopencl*.whl; do + # dev + # /opt/python/cp37-cp37m/bin/twine upload \ + # --skip-existing \ + # --repository-url https://test.pypi.org/legacy/ \ + # -u "${TWINE_USERNAME}" -p "${TWINE_PASSWORD}" \ + # "${WHEEL}" + # prod + /opt/python/cp37-cp37m/bin/twine upload \ + --skip-existing \ + -u "${TWINE_USERNAME}" -p "${TWINE_PASSWORD}" \ + "${WHEEL}" +done diff --git a/travis/fix-wheel.py b/travis/fix-wheel.py new file mode 100644 index 0000000000000000000000000000000000000000..2f8bf10d1a1cb2a8244c1c92a3ed428fd9c5d503 --- /dev/null +++ b/travis/fix-wheel.py @@ -0,0 +1,22 @@ +import sys +import os.path +import shutil +from glob import glob + +from delocate import wheeltools + +def add_library(paths): + wheel_fnames = glob('/io/wheelhouse/pyopencl*.whl') + for fname in wheel_fnames: + print('Processing', fname) + with wheeltools.InWheel(fname, fname): + for lib_path in paths: + shutil.copy2(lib_path, os.path.join('pyopencl', '.libs')) + +def main(): + args = list(sys.argv) + args.pop(0) + add_library(args) + +if __name__ == '__main__': + main()