rename_wheels.sh 1.08 KB
Newer Older
1
2
3
4
5
6
7
#!/usr/bin/env bash
set -ex

WHEEL_DIR="dist"

wheel_files=($WHEEL_DIR/*.whl)
for wheel in "${wheel_files[@]}"; do
8
9
    intermediate_wheel="${wheel/linux/manylinux2014}"

10
11
12
13
14
15
16
17
18
    # Extract the current python version from the wheel name
    if [[ $intermediate_wheel =~ -cp([0-9]+)- ]]; then
        cp_version="${BASH_REMATCH[1]}"
    else
        echo "Could not extract Python version from wheel name: $intermediate_wheel"
        continue
    fi

    # Detect CUDA version and add appropriate suffix
19
20
    if ls /usr/local/ | grep -q "12.4"; then
        new_wheel="${intermediate_wheel/-cp${cp_version}/+cu124-cp${cp_version}}"
21
22
    elif ls /usr/local/ | grep -q "12.8"; then
        new_wheel="${intermediate_wheel/-cp${cp_version}/+cu128-cp${cp_version}}"
23
24
    elif ls /usr/local/ | grep -q "13.0"; then
        new_wheel="${intermediate_wheel/-cp${cp_version}/+cu130-cp${cp_version}}"
25
26
27
    else
        new_wheel="$intermediate_wheel"
    fi
28
29
30
31
32
33
34

    if [[ "$wheel" != "$new_wheel" ]]; then
        echo "Renaming $wheel to $new_wheel"
        mv -- "$wheel" "$new_wheel"
    fi
done
echo "Wheel renaming completed."