check_python_dists.sh 1.55 KB
Newer Older
1
2
3
4
5
6
7
8
9
#!/bin/sh

DIST_DIR=${1}

echo "checking Python package distributions in '${DIST_DIR}'"

pip install \
    -qq \
    check-wheel-contents \
10
    twine || exit 1
11
12

echo "twine check..."
13
twine check --strict ${DIST_DIR}/* || exit 1
14
15
16

if { test "${TASK}" = "bdist" || test "${METHOD}" = "wheel"; }; then
    echo "check-wheel-contents..."
17
    check-wheel-contents ${DIST_DIR}/*.whl || exit 1
18
19
fi

20
21
22
23
24
25
26
27
PY_MINOR_VER=$(python -c "import sys; print(sys.version_info.minor)")
if [ $PY_MINOR_VER -gt 7 ]; then
    echo "pydistcheck..."
    pip install pydistcheck
    if { test "${TASK}" = "cuda" || test "${METHOD}" = "wheel"; }; then
        pydistcheck \
            --inspect \
            --ignore 'compiled-objects-have-debug-symbols,distro-too-large-compressed' \
28
            --max-allowed-size-uncompressed '100M' \
29
            --max-allowed-files 800 \
30
            ${DIST_DIR}/* || exit 1
31
32
33
34
35
36
37
    elif { test $(uname -m) = "aarch64"; }; then
        pydistcheck \
            --inspect \
            --ignore 'compiled-objects-have-debug-symbols' \
            --max-allowed-size-compressed '5M' \
            --max-allowed-size-uncompressed '15M' \
            --max-allowed-files 800 \
38
            ${DIST_DIR}/* || exit 1
39
40
41
42
43
44
    else
        pydistcheck \
            --inspect \
            --max-allowed-size-compressed '5M' \
            --max-allowed-size-uncompressed '15M' \
            --max-allowed-files 800 \
45
            ${DIST_DIR}/* || exit 1
46
47
48
49
50
    fi
else
    echo "skipping pydistcheck (does not support Python 3.${PY_MINOR_VER})"
fi

51
echo "done checking Python package distributions"