From c1890578f92f6dfba317afe0d205205cc99156e0 Mon Sep 17 00:00:00 2001 From: Isuru Fernando <isuruf@gmail.com> Date: Wed, 13 Feb 2019 09:41:16 -0600 Subject: [PATCH] Include license file in wheel --- travis/build-wheels.sh | 42 ++++++++++++++++++++++++++++++------------ travis/fix-wheel.py | 22 ++++++++++++++++++++++ 2 files changed, 52 insertions(+), 12 deletions(-) create mode 100644 travis/fix-wheel.py diff --git a/travis/build-wheels.sh b/travis/build-wheels.sh index 22df67a7..d26aad2c 100755 --- a/travis/build-wheels.sh +++ b/travis/build-wheels.sh @@ -1,17 +1,31 @@ #!/bin/bash set -e -x -export PYHOME=/home -export CL_H=${PYHOME}/cl_h -export CL_ICDLOAD=${PYHOME}/cl_icdload - -cd ${PYHOME} -yum install -y git cmake -git clone https://github.com/KhronosGroup/OpenCL-Headers.git ${CL_H} -git clone https://github.com/KhronosGroup/OpenCL-ICD-Loader.git ${CL_ICDLOAD} -ln -s ${CL_H}/CL /usr/include/CL -make -C ${CL_ICDLOAD} -cp -r ${CL_ICDLOAD}/build/lib/lib* /usr/lib +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 @@ -20,10 +34,14 @@ for PYBIN in /opt/python/*/bin; do done # Bundle external shared libraries into the wheels -for whl in wheelhouse/*.whl; do +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 diff --git a/travis/fix-wheel.py b/travis/fix-wheel.py new file mode 100644 index 00000000..2f8bf10d --- /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() -- GitLab