check-python-dists.sh 1.7 KB
Newer Older
1
2
#!/bin/sh

3
set -e -u
4

5
6
DIST_DIR=${1}

7
8
9
10
# defaults
METHOD=${METHOD:-""}
TASK=${TASK:-""}

11
echo "checking Python-package distributions in '${DIST_DIR}'"
12
13
14
15

pip install \
    -qq \
    check-wheel-contents \
16
    twine || exit 1
17
18

echo "twine check..."
19
twine check --strict "$(echo "${DIST_DIR}"/*)" || exit 1
20
21
22

if { test "${TASK}" = "bdist" || test "${METHOD}" = "wheel"; }; then
    echo "check-wheel-contents..."
23
    check-wheel-contents "$(echo "${DIST_DIR}"/*.whl)" || exit 1
24
25
fi

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

58
echo "done checking Python-package distributions"