"example/mnist/mnist_ptq.py" did not exist on "eae6a3bd7692c8d026fb2007afe8e733f5dd2c05"
travis_linux_steps.sh 2.64 KB
Newer Older
1
#!/bin/bash
2
# Wheel build, install, run test steps on Linux
3
4
5
#
# In fact the main work is to wrap up the real functions in docker commands.
# The real work is in the BUILD_SCRIPT (which builds the wheel) and
6
# `docker_install_run.sh`, which can be configured with `config.sh`.
7
8
9
10
11
#
# Must define
#  before_install
#  build_wheel
#  install_run
12
set -e
13

14
15
MANYLINUX_URL=${MANYLINUX_URL:-https://nipy.bic.berkeley.edu/manylinux}

16
# Get our own location on this filesystem
17
MULTIBUILD_DIR=$(dirname "${BASH_SOURCE[0]}")
18

19
20
21
# Allow travis Python version as proxy for multibuild Python version
MB_PYTHON_VERSION=${MB_PYTHON_VERSION:-$TRAVIS_PYTHON_VERSION}

22
function before_install {
23
    # Install a virtualenv to work in.
24
25
26
27
28
29
    virtualenv --python=python venv
    source venv/bin/activate
    python --version # just to check
    pip install --upgrade pip wheel
}

30
31
function build_wheel {
    # Builds wheel, puts into $WHEEL_SDIR
32
    #
33
34
    # In fact wraps the actual work which happens in the container.
    #
35
    # Depends on
36
37
    #     REPO_DIR  (or via input argument)
    #     PLAT (can be passed in as argument)
38
    #     MB_PYTHON_VERSION
39
40
41
42
43
44
45
    #     UNICODE_WIDTH (optional)
    #     BUILD_DEPENDS (optional)
    #     MANYLINUX_URL (optional)
    #     WHEEL_SDIR (optional)
    local repo_dir=${1:-$REPO_DIR}
    [ -z "$repo_dir" ] && echo "repo_dir not defined" && exit 1
    local plat=${2:-$PLAT}
46
47
48
    local docker_image=quay.io/pypa/manylinux1_$plat
    docker pull $docker_image
    docker run --rm \
49
        -e PYTHON_VERSION="$MB_PYTHON_VERSION" \
50
51
        -e UNICODE_WIDTH="$UNICODE_WIDTH" \
        -e WHEEL_SDIR="$WHEEL_SDIR" \
52
        -e MANYLINUX_URL="$MANYLINUX_URL" \
53
        -e BUILD_DEPENDS="$BUILD_DEPENDS" \
54
        -e REPO_DIR="$repo_dir" \
55
        -e PLAT="$PLAT" \
56
        -v $PWD:/io \
57
        $docker_image /io/$MULTIBUILD_DIR/docker_build_wrap.sh
58
}
59
60

function install_run {
61
62
63
64
65
66
    # Install wheel, run tests
    #
    # In fact wraps the actual work which happens in the container.
    #
    # Depends on
    #  PLAT (can be passed in as argument)
67
    #  MB_PYTHON_VERSION
68
69
70
71
    #  UNICODE_WIDTH (optional)
    #  WHEEL_SDIR (optional)
    #  MANYLINUX_URL (optional)
    #  TEST_DEPENDS  (optional)
Matthew Brett's avatar
Matthew Brett committed
72
    local plat=${1:-$PLAT}
73
    bitness=$([ "$plat" == i686 ] && echo 32 || echo 64)
74
75
76
    local docker_image="matthewbrett/trusty:$bitness"
    docker pull $docker_image
    docker run --rm \
77
        -e PYTHON_VERSION="$MB_PYTHON_VERSION" \
78
79
80
81
82
        -e UNICODE_WIDTH="$UNICODE_WIDTH" \
        -e WHEEL_SDIR="$WHEEL_SDIR" \
        -e MANYLINUX_URL="$MANYLINUX_URL" \
        -e TEST_DEPENDS="$TEST_DEPENDS" \
        -v $PWD:/io \
83
        $docker_image /io/$MULTIBUILD_DIR/docker_test_wrap.sh
84
}