File: 50-dib-python-version

package info (click to toggle)
python-diskimage-builder 3.2.1-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 4,616 kB
  • sloc: sh: 7,689; python: 3,933; makefile: 34
file content (40 lines) | stat: -rw-r--r-- 1,214 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Pick which distros we need to force python2 and which to python3
if [ -z "${DIB_PYTHON_VERSION:-}" ]; then
    if [ "$DISTRO_NAME" == "ubuntu" ]; then
        if [ "$DIB_RELEASE" == "trusty" ]; then
            DIB_PYTHON_VERSION=2
        fi
    elif [ "$DISTRO_NAME" == "debian" ]; then
        DIB_PYTHON_VERSION=2
    elif [ "$DISTRO_NAME" == "fedora" ]; then
        if [ "$DIB_RELEASE" -le 22 ]; then
            DIB_PYTHON_VERSION=2
        fi
    elif [ "$DISTRO_NAME" == "centos7" ]; then
        DIB_PYTHON_VERSION=2
    elif [ "$DISTRO_NAME" == "rhel7" ]; then
        # TODO(nmagnezi): Remove this when the 'rhel7' element gets replaced by 'rhel'
        DIB_PYTHON_VERSION=2
    elif [[ "$DISTRO_NAME" =~ (rhel|centos) ]]; then
        if [[ "${DIB_RELEASE}" == "7" ]]; then
            DIB_PYTHON_VERSION=2
        else
            DIB_PYTHON_VERSION=3
        fi
    elif [ "$DISTRO_NAME" == "opensuse" ]; then
        if [ "${DIB_RELEASE:0:2}" == "42" ]; then
            DIB_PYTHON_VERSION=2
        fi
    fi
fi

if [ -z "${DIB_PYTHON_VERSION:-}" ]; then
    DIB_PYTHON_VERSION=3
fi

export DIB_PYTHON_VERSION
export DIB_PYTHON=python${DIB_PYTHON_VERSION}

# Local variables:
# mode: sh
# End: