travis_osx_steps.sh 1.59 KB
Newer Older
1
#!/bin/bash
2
# Wheel build, install, run test steps on OSX
3
4
5
set -e

# Get needed utilities
6
MULTIBUILD_DIR=$(dirname "${BASH_SOURCE[0]}")
Matthew Brett's avatar
Matthew Brett committed
7
source $MULTIBUILD_DIR/osx_utils.sh
8

9
# NB - config_funcs.sh sourced at end of this function
10
11
12
13

function before_install {
    export CC=clang
    export CXX=clang++
Matthew Brett's avatar
Matthew Brett committed
14
    get_macpython_environment $TRAVIS_PYTHON_VERSION venv
15
16
17
18
    source venv/bin/activate
    pip install --upgrade pip wheel
}

19
20
21
22
23
24
25
26
function delocate_wheel {
    local wheelhouse=$PWD/$WHEEL_SDIR
    pip install delocate
    delocate-listdeps $wheelhouse/*.whl # lists library dependencies
    delocate-wheel $wheelhouse/*.whl # copies library dependencies into wheel
    delocate-addplat --rm-orig -x 10_9 -x 10_10 $wheelhouse/*.whl
}

27
28
function build_wheel {
    # Builds wheel, puts into $WHEEL_SDIR
29
30
    #
    # Depends on
31
    #  WHEEL_SDIR
32
    #  BUILD_DEPENDS
33
    #  REPO_DIR | PKG_SPEC
34
    #  BUILD_COMMIT
35
    local wheelhouse=$PWD/$WHEEL_SDIR
36
    if [ -n $(is_function "pre_build") ]; then pre_build; fi
Matthew Brett's avatar
Matthew Brett committed
37
    if [ -n "$BUILD_DEPENDS" ]; then pip install $BUILD_DEPENDS; fi
38
    if [ -n "$REPO_DIR" ]; then
39
40
41
        (cd $REPO_DIR \
            && clean_fix_source $BUILD_COMMIT \
            && pip wheel -w $wheelhouse --no-deps .)
42
    else
43
        pip wheel -w $wheelhouse --no-deps $PKG_SPEC
44
    fi
45
    delocate_wheel
46
}
47
48
49
50
51
52
53
54
55
56
57

function install_run {
    # Depend on function `run_tests` defined in `config_funcs.sh`
    install_wheel
    mkdir tmp_for_test
    (cd tmp_for_test && run_tests)
}

# Local configuration may define custom pre-build, source patching.
# It can also overwrite the functions above
source $PWD/config_funcs.sh