File: build-wheels.sh

package info (click to toggle)
python-confluent-kafka 1.7.0-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,900 kB
  • sloc: python: 8,335; ansic: 6,065; sh: 1,203; makefile: 178
file content (71 lines) | stat: -rwxr-xr-x 1,653 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
#
#
# Build wheels (on Linux or OSX) using cibuildwheel.
#

this_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"


# Skip PyPy, old Python3 versions, and x86 builds.
export CIBW_SKIP="pp* cp35-* *i686"
# Run a simple test suite
export CIBW_TEST_REQUIRES="-r tests/requirements.txt"
export CIBW_TEST_COMMAND="pytest {project}/tests/test_Producer.py"


librdkafka_version=$1
wheeldir=$2

if [[ -z $wheeldir ]]; then
    echo "Usage: $0 <librdkafka-nuget-version> <wheeldir>"
    exit 1
fi

set -ex

[[ -d $wheeldir ]] || mkdir -p "$wheeldir"


case $OSTYPE in
    linux*)
        os=linux
        # Need to set up env vars (in docker) so that setup.py
        # finds librdkafka.
        lib_dir=dest/runtimes/linux-x64/native
        export CIBW_ENVIRONMENT="CFLAGS=-I\$PWD/dest/build/native/include LDFLAGS=-L\$PWD/$lib_dir LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$PWD/$lib_dir"
        ;;
    darwin*)
        os=macos
        # Need to set up env vars so that setup.py finds librdkafka.
        lib_dir=dest/runtimes/osx-x64/native
        export CFLAGS="-I${PWD}/dest/build/native/include"
        export LDFLAGS="-L${PWD}/$lib_dir"
        ;;
    *)
        echo "$0: Unsupported OSTYPE $OSTYPE"
        exit 1
        ;;
esac


$this_dir/install-librdkafka.sh $librdkafka_version dest

install_pkgs=cibuildwheel==1.11.0

python3 -m pip install $install_pkgs ||
    pip3 install $install_pkgs

if [[ -z $TRAVIS ]]; then
    cibw_args="--platform $os"
fi

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/$lib_dir python3 -m cibuildwheel --output-dir $wheeldir $cibw_args

ls $wheeldir

for f in $wheeldir/*whl ; do
    echo $f
    unzip -l $f
done