"platforms/cuda/src/kernels/coulombLennardJones.cu" did not exist on "2a465d40e96f2d8940980ff8487efba75c7ca0b3"
manylinux_utils.sh 2.57 KB
Newer Older
1
#!/bin/bash
mattip's avatar
mattip committed
2
# Useful utilities common across manylinux builds
3
4
5

MULTIBUILD_DIR=$(dirname "${BASH_SOURCE[0]}")
source $MULTIBUILD_DIR/common_utils.sh
6

Matthew Brett's avatar
Matthew Brett committed
7
8
9
10
11
function get_platform {
    # Report platform as given by uname
    python -c 'import platform; print(platform.uname()[4])'
}

12
function repair_wheelhouse {
13
14
15
	# Runs 'auditwheel repair' over all wheels in a directory
	# If the wheel is not renamed by the repair process,
	# then the original wheel will be left unmodified
16
    local in_dir=$1
17
    local out_dir=${2:-$in_dir}
18
    for whl in $in_dir/*.whl; do
19
20
        if [[ $whl == *none-any.whl ]]; then  # Pure Python wheel
            if [ "$in_dir" != "$out_dir" ]; then cp $whl $out_dir; fi
21
        else
22
23
24
25
26
27
28
29
30
31
            local tmpdir=$(mktemp -d -t)
            
            auditwheel repair $whl -w $tmpdir/
            
            local built=$(find $tmpdir -name *.whl)
            if [ $(basename $built) == $(basename $whl) ]; then
                if [ "$in_dir" != "$out_dir" ]; then cp $whl $out_dir; fi
            else
                cp $built $out_dir
                
32
33
34
                # Remove unfixed if writing into same directory
                if [ "$in_dir" == "$out_dir" ]; then rm $whl; fi
            fi
35
            rm -rf $tmpdir
36
37
38
39
        fi
    done
    chmod -R a+rwX $out_dir
}
xoviat's avatar
xoviat committed
40
41
42

function activate_ccache {
    # Link up the correct location for ccache
xoviat's avatar
xoviat committed
43
    mkdir -p /parent-home/.ccache
xoviat's avatar
xoviat committed
44
45
46
    ln -s /parent-home/.ccache $HOME/.ccache

    # Now install ccache
John Jones's avatar
John Jones committed
47
48
49
    if [ -n "$IS_ALPINE" ]; then 
        supress apk add ccache
        export PATH="/usr/lib/ccache/bin:$PATH"
mattip's avatar
mattip committed
50
    else
John Jones's avatar
John Jones committed
51
52
53
54
55
56
57
        if [[ $MB_ML_VER == "_2_24" ]]; then
            # debian:9 based distro
            suppress apt-get install -y ccache
        else
            # centos based distro
            suppress yum_install ccache
        fi
xoviat's avatar
xoviat committed
58

John Jones's avatar
John Jones committed
59
60
61
62
63
64
65
66
67
68
69
        # Create fake compilers and prepend them to the PATH
        # Note that yum is supposed to create these for us,
        # but I had trouble finding them
        local ccache_dir=/usr/lib/ccache/compilers
        mkdir -p $ccache_dir
        ln -s /usr/bin/ccache $ccache_dir/gcc
        ln -s /usr/bin/ccache $ccache_dir/g++
        ln -s /usr/bin/ccache $ccache_dir/cc
        ln -s /usr/bin/ccache $ccache_dir/c++
        export PATH=$ccache_dir:$PATH
    fi
xoviat's avatar
xoviat committed
70
71

    # Prove to the developer that ccache is activated
xoviat's avatar
xoviat committed
72
    echo "Using C compiler: $(which gcc)"
xoviat's avatar
xoviat committed
73
}
mattip's avatar
mattip committed
74

75
76
77
78
79
function yum_install {
    # CentOS 5 yum doesn't fail in some cases, e.g. if package is not found
    # https://serverfault.com/questions/694942/yum-should-error-when-a-package-is-not-available
    yum install -y "$1" && rpm -q "$1"
}