Skip to content

Instantly share code, notes, and snippets.

@jacky9813
Last active February 12, 2025 05:46
Show Gist options
  • Select an option

  • Save jacky9813/619d2eff88c080de9402924e46fc55f7 to your computer and use it in GitHub Desktop.

Select an option

Save jacky9813/619d2eff88c080de9402924e46fc55f7 to your computer and use it in GitHub Desktop.

Revisions

  1. jacky9813 revised this gist Oct 4, 2023. 1 changed file with 67 additions and 174 deletions.
    241 changes: 67 additions & 174 deletions building-python3.11.md
    Original file line number Diff line number Diff line change
    @@ -17,31 +17,86 @@ default `python` or `python3` command.

    ## Operating Systems

    * [Debian 10+, Ubuntu 18.04+](#debian-10-ubuntu-1804)
    * [CentOS 7](#centos-7)
    * [Rocky Linux 8](#rocky-linux-8)
    * [Rocky Linux 9](#rocky-linux-9)
    * [openSUSE Leap 15](#opensuse-leap-15)
    * [openSUSE Leap 42](#opensuse-leap-42)
    * [Alpine Linux 3.18](#alpine-linux-318)
    | Distro | Note |
    | --- | --- |
    | [Debian 10+, Ubuntu 18.04+](#debian-10-ubuntu-1804) | (For Ubuntu 18.04) Additional info required by pkgconfig. |
    | [CentOS 7](#centos-7) | Additional info required by pkgconfig.<br>CentOS uses tk 8.5, while Python 3.10 and later uses tk 8.6 by default. |
    | [Rocky Linux 8](#rocky-linux-8) | |
    | [Rocky Linux 9](#rocky-linux-9) | |
    | [openSUSE Leap 15](#opensuse-leap-15) | |
    | [openSUSE Leap 42](#opensuse-leap-42) | Building OpenSSL 1.1.1 or later version is required. |
    | [Alpine Linux 3.18](#alpine-linux-318) | |

    ## Debian 10+, Ubuntu 18.04+

    ### Normal Install

    Tested in [debian:bullseye](https://hub.docker.com/_/debian).
    Tested in [debian:buster](https://hub.docker.com/_/debian) and [ubuntu:18.04](https://hub.docker.com/_/ubuntu).

    ```bash
    #!/bin/bash
    PYTHON_VERSION=3.12.0
    TZ=Etc/UTC
    source /etc/os-release

    ln -s /usr/share/zoneinfo/$TZ /etc/localtime
    echo $TZ > /etc/timezone

    apt update
    apt install -y libncurses-dev libbz2-dev libgdbm-dev liblzma-dev libssl-dev tk-dev \
    echo "" | apt upgrade -y
    echo "" | apt install -y libncurses-dev libbz2-dev libgdbm-dev liblzma-dev libssl-dev tk-dev \
    uuid-dev libreadline-dev libsqlite3-dev libffi-dev gcc make automake \
    wget libgdbm-dev libgdbm-compat-dev

    wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz
    tar -xvf Python-${PYTHON_VERSION}.tgz
    cd Python-${PYTHON_VERSION}

    if [ "$ID" == "ubuntu" ] && [ "$VERSION_ID" == "18.04" ]; then
    # For some reason, both tk-dev and tcl-dev doesn't include their pkgconfig files.
    # Although I can make a PR to the Python repo, it just doesn't make any sense for creating an
    # PR for an unsupported verison of Ubuntu. Hence I just post it here.
    mkdir -p Misc/ubuntu18.04
    cat << EOF > Misc/ubuntu18.04/tcl.pc
    # tcl pkg-config source file
    prefix=/usr
    exec_prefix=/usr
    libdir=/usr/lib/$(dpkg-architecture -q DEB_BUILD_GNU_TYPE)
    includedir=/usr/include/tcl8.6
    Name: Tool Command Language
    Description: Tcl is a powerful, easy-to-learn dynamic programming language, suitable for a wide range of uses.
    URL: http://www.tcl.tk/
    Version: 8.6
    Requires.private: zlib >= 1.2.3
    Libs: -L\${libdir} -ltcl8.6 -ltclstub8.6
    Libs.private: -ldl -lz -lpthread -lm
    Cflags: -I\${includedir}
    EOF

    cat << EOF > Misc/ubuntu18.04/tk.pc
    # tk pkg-config source file
    prefix=/usr
    exec_prefix=/usr
    libdir=/usr/lib/$(dpkg-architecture -q DEB_BUILD_GNU_TYPE)
    includedir=/usr/include/tcl8.6
    Name: The Tk Toolkit
    Description: Tk is a cross-platform graphical user interface toolkit, the standard GUI not only for Tcl, but for many other dynamic languages as well.
    URL: https://www.tcl-lang.org/
    Version: 8.6
    Requires: tcl >= 8.6
    Libs: -L\${libdir} -ltk8.6 -ltkstub8.6
    Libs.private: -lXft -lfontconfig -lfreetype -lfontconfig -lX11 -lXss -lXext
    Cflags: -I\${includedir}
    EOF

    export PKG_CONFIG_PATH=$(pwd)/Misc/ubuntu18.04

    fi

    ./configure --enable-loadable-sqlite-extensions
    make -j$(nproc)
    make altinstall
    @@ -51,9 +106,7 @@ Testing (Before `make altinstall`)

    ```bash
    #!/bin/bash
    apt install -y locales gdb g++
    sed -i -E 's/^\s*#\s+(\w+_\w+)/\1/g' /etc/locale.gen
    locale-gen
    apt install -y locales locales-all gdb g++
    make test
    ```

    @@ -72,172 +125,12 @@ make test
    test_ossaudiodev test_tix test_tkinter test_ttk test_winsound
    test_zipfile64
    Total duration: 1 min 21 sec
    Total tests: run=41,575 skipped=1,434
    Total duration: 1 min 15 sec
    Total tests: run=41,575 skipped=1,482
    Total test files: run=477/483 skipped=11 resource_denied=6
    Result: SUCCESS
    ```

    ### Build DEB Package

    Note: Still under testing in [ubuntu:20.04](https://hub.docker.com/_/ubuntu). Testing in debian:10 or debian:11 is planned.

    Things to build:

    * python3.11-venv requires:
    * [setuptools](https://tracker.debian.org/pkg/setuptools)
    * [python-pip](https://tracker.debian.org/pkg/python-pip)
    * [wheel](https://tracker.debian.org/pkg/wheel)

    ```bash
    #!/bin/bash
    ################################
    # Settings
    ################################
    source /etc/os-release
    # Both Debian and Ubuntu have official Python 3.11.2-6 release
    # It is suggested to stick with that.
    PYTHON_BASE_VERSION=3.11
    PYTHON_VERSION=${PYTHON_BASE_VERSION}.2
    PYTHON_RELEASE_ID=6
    STDLIB_RELEASE_ID=3
    TIMEZONE=Etc/UTC

    ################################
    # Primary Python Package
    ################################

    # Configure /etc/localtime so apt won't ask anything when installing tzdata
    ln -s /usr/share/zoneinfo/${TIMEZONE} /etc/localtime

    # Installing build tools
    apt update
    apt install -y build-essential devscripts equivs debian-keyring python3-pip

    mkdir python${PYTHON_BASE_VERSION}

    pushd python${PYTHON_BASE_VERSION} # 1 python${PYTHON_BASE_VERSION}

    # For Debian users, find dsc files from Debian Package Tracker:
    # https://tracker.debian.org/pkg/python3.11
    #
    # For Ubuntu users, find dsc files from Launchpad:
    # https://launchpad.net/ubuntu/+source/python3.11

    DSC_LINK=https://deb.debian.org/debian/pool/main/p/python${PYTHON_BASE_VERSION}/python${PYTHON_BASE_VERSION}_${PYTHON_VERSION}-${PYTHON_RELEASE_ID}.dsc

    if [ "$ID" == "ubuntu" ]; then
    DSC_LINK=https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/python${PYTHON_BASE_VERSION}/${PYTHON_VERSION}-${PYTHON_RELEASE_ID}/python${PYTHON_BASE_VERSION}_${PYTHON_VERSION}-${PYTHON_RELEASE_ID}.dsc
    elif [ "$ID" != "debian" ]; then
    echo "Unknown distro $ID. Using source code from Debian."
    fi

    dget "$DSC_LINK" --build

    pushd python3.11-${PYTHON_VERSION}/debian # 2 python3.11-${PYTHON_VERSION}/debian python${PYTHON_BASE_VERSION}

    if ! apt list | grep valgrind-if-available; then
    if apt show valgrind &>/dev/null; then
    sed -i 's/valgrind-if-available/valgrind/' control
    else
    sed -i 's/valgrind-if-available//' control
    fi
    fi

    popd # 1 python${PYTHON_BASE_VERSION}

    # Installing build dependencies
    mk-build-deps python3.11-${PYTHON_VERSION}/debian/control
    apt install -y ./python3.11-build-deps_${PYTHON_VERSION}-${PYTHON_RELEASE_ID}_$(dpkg-architecture --query DEB_TARGET_ARCH_CPU).deb

    # Sphinx 3.2 is required when buliding documents.
    pip3 install Sphinx==3.2

    pushd python3.11-${PYTHON_VERSION} # 2 python3.11-${PYTHON_VERSION} python${PYTHON_BASE_VERSION}


    # Put -d here so that check will bypass checking if
    # valgrind-if-available is installed, which a little older
    # distro like Ubuntu 20.04 LTS doesn't have.
    dpkg-buildpackage -us -uc -d -j$(nproc)

    # Aaaaaand, a painfully slow process than just compile the source code compared to
    # other methods in this document.
    # It takes about 2 hours for my AMD Ryzen 5900X machine to build this while others
    # taking around 2 minutes.

    popd # 1 python${PYTHON_BASE_VERSION}

    # Install packages for building stdlib extensions
    apt install -y $(find . \
    -name '*python3.11-dev*.deb' -or \
    -name '*python3.11_*.deb' -not -name 'idle*' -or \
    -name 'libpython3.11-stdlib*.deb' -or \
    -name '*python3.11-minimal*.deb' -or \
    -name '*python3.11-dbg*.deb')

    popd # 0

    ################################
    # Standard modules for Python
    ################################

    mkdir python3-stdlib-extensions

    pushd python3-stdlib-extensions # 1 python3-stdlib-extensions

    # For Debian users, find dsc files from Debian Package Tracker:
    # https://tracker.debian.org/pkg/python3-stdlib-extensions
    #
    # For Ubuntu users, find dsc files from Launchpad:
    # https://launchpad.net/ubuntu/+source/python3-stdlib-extensions


    STDLIB_DSC_LINK=https://deb.debian.org/debian/pool/main/p/python3-stdlib-extensions/python3-stdlib-extensions_${PYTHON_VERSION}-${STDLIB_RELEASE_ID}.dsc

    if [ "$ID" == "ubuntu" ]; then
    STDLIB_DSC_LINK=https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/python3-stdlib-extensions/${PYTHON_VERSION}-${STDLIB_RELEASE_ID}/python3-stdlib-extensions_${PYTHON_VERSION}-${STDLIB_RELEASE_ID}.dsc
    elif [ "$ID" != "debian" ]; then
    echo "Unknown distro $ID. Using source code from Debian."
    fi

    dget "$STDLIB_DSC_LINK" --build

    pushd python3-stdlib-extensions-${PYTHON_VERSION}/debian # 2 python3-stdlib-extensions-${PYTHON_VERSION}/debian python3-stdlib-extensions

    # Rename all python3-* packages to python3.11-*
    cp control control.old
    cat control.old | perl -pe "s/python3-(?"'!'"stdlib)/python${PYTHON_BASE_VERSION}-/" > control
    rm control.old

    # Renaming dependent packages
    sed -i "s|python3-|python${PYTHON_BASE_VERSION}-|g" rules
    sed -i "s|python3 |python${PYTHON_BASE_VERSION} |g" rules
    sed -i "s|python3:any|python${PYTHON_BASE_VERSION}:any|g" rules

    # Assign PYVERS to full version number so that $* will be PYTHON_BASE_VERSION
    sed -i "s|PYVERS *= *${PYTHON_BASE_VERSION}|PYVERS = ${PYTHON_VERSION}|" rules

    # Rename files, as filenames in rules changes
    for f in $(ls -d ./python3*); do
    mv "$f" $(echo "$f" | sed "s/python3/python${PYTHON_BASE_VERSION}/")
    done
    popd # 1 python3-stdlib-extensions

    # Install dependencies
    mk-build-deps python3-stdlib-extensions-${PYTHON_VERSION}/debian/control
    apt install -y ./python3-stdlib-extensions-build-deps_${PYTHON_VERSION}-${STDLIB_RELEASE_ID}_all.deb

    pushd python3-stdlib-extensions-${PYTHON_VERSION} # 2 python3-stdlib-extensions-${PYTHON_VERSION} python3-stdlib-extensions

    dpkg-buildpackage -us -uc -j$(nproc)

    popd # 1 python3-stdlib-extensions
    popd # 0

    find . -name '*.deb' -exec mv {} ./ \;
    ```

    ## CentOS 7

    Tested on [centos:7](https://hub.docker.com/_/centos)
  2. jacky9813 revised this gist Oct 4, 2023. 1 changed file with 17 additions and 15 deletions.
    32 changes: 17 additions & 15 deletions building-python3.11.md
    Original file line number Diff line number Diff line change
    @@ -27,18 +27,13 @@ default `python` or `python3` command.

    ## Debian 10+, Ubuntu 18.04+

    IMPORTANT: Debian 12 Bookworm has `python3` that is Python 3.11.
    BEWARE THAT IT MAY GET VERY CONFUSING IF MULTIPLE PYTHON 3.11 BUILDS ARE INSTALLED.

    ### Normal Install

    Tested in [debian:buster](https://hub.docker.com/_/debian) and [ubuntu:20.04](https://hub.docker.com/_/ubuntu).

    * Note: For Ubuntu 18.04 with both packages `tk-dev` (8.6.0+9) and `tk8.6-dev` (8.6.8-4)
    installed, `_tkinter` module is refused to compile for unknown reason.
    Tested in [debian:bullseye](https://hub.docker.com/_/debian).

    ```bash
    PYTHON_VERSION=3.11.5
    #!/bin/bash
    PYTHON_VERSION=3.12.0

    apt update
    apt install -y libncurses-dev libbz2-dev libgdbm-dev liblzma-dev libssl-dev tk-dev \
    @@ -65,15 +60,22 @@ make test
    ```
    == Tests result: SUCCESS ==
    420 tests OK.
    466 tests OK.
    14 tests skipped:
    test_devpoll test_ioctl test_kqueue test_launcher test_msilib
    test_ossaudiodev test_startfile test_tix test_tk test_ttk_guionly
    test_winconsoleio test_winreg test_winsound test_zipfile64
    11 tests skipped:
    test.test_asyncio.test_windows_events
    test.test_asyncio.test_windows_utils test_devpoll test_ioctl
    test_kqueue test_launcher test_msilib test_startfile
    test_winconsoleio test_winreg test_wmi
    6 tests skipped (resource denied):
    test_ossaudiodev test_tix test_tkinter test_ttk test_winsound
    test_zipfile64
    Total duration: 2 min 13 sec
    Tests result: SUCCESS
    Total duration: 1 min 21 sec
    Total tests: run=41,575 skipped=1,434
    Total test files: run=477/483 skipped=11 resource_denied=6
    Result: SUCCESS
    ```

    ### Build DEB Package
  3. jacky9813 revised this gist Sep 23, 2023. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions building-python3.11.md
    Original file line number Diff line number Diff line change
    @@ -80,6 +80,13 @@ Tests result: SUCCESS

    Note: Still under testing in [ubuntu:20.04](https://hub.docker.com/_/ubuntu). Testing in debian:10 or debian:11 is planned.

    Things to build:

    * python3.11-venv requires:
    * [setuptools](https://tracker.debian.org/pkg/setuptools)
    * [python-pip](https://tracker.debian.org/pkg/python-pip)
    * [wheel](https://tracker.debian.org/pkg/wheel)

    ```bash
    #!/bin/bash
    ################################
  4. jacky9813 revised this gist Sep 23, 2023. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions building-python3.11.md
    Original file line number Diff line number Diff line change
    @@ -152,8 +152,10 @@ pushd python3.11-${PYTHON_VERSION} # 2 python3.11-${PYTHON_VERSION} python${PYTH
    # distro like Ubuntu 20.04 LTS doesn't have.
    dpkg-buildpackage -us -uc -d -j$(nproc)

    # Aaaaaand, a painfully slow process than just compile the source code.
    # It takes hours for my AMD Ryzen 5900X machine to build this.
    # Aaaaaand, a painfully slow process than just compile the source code compared to
    # other methods in this document.
    # It takes about 2 hours for my AMD Ryzen 5900X machine to build this while others
    # taking around 2 minutes.

    popd # 1 python${PYTHON_BASE_VERSION}

  5. jacky9813 revised this gist Sep 23, 2023. 1 changed file with 37 additions and 12 deletions.
    49 changes: 37 additions & 12 deletions building-python3.11.md
    Original file line number Diff line number Diff line change
    @@ -82,6 +82,9 @@ Note: Still under testing in [ubuntu:20.04](https://hub.docker.com/_/ubuntu). Te

    ```bash
    #!/bin/bash
    ################################
    # Settings
    ################################
    source /etc/os-release
    # Both Debian and Ubuntu have official Python 3.11.2-6 release
    # It is suggested to stick with that.
    @@ -91,9 +94,14 @@ PYTHON_RELEASE_ID=6
    STDLIB_RELEASE_ID=3
    TIMEZONE=Etc/UTC

    ################################
    # Primary Python Package
    ################################

    # Configure /etc/localtime so apt won't ask anything when installing tzdata
    ln -s /usr/share/zoneinfo/${TIMEZONE} /etc/localtime

    # Installing build tools
    apt update
    apt install -y build-essential devscripts equivs debian-keyring python3-pip

    @@ -120,14 +128,16 @@ dget "$DSC_LINK" --build
    pushd python3.11-${PYTHON_VERSION}/debian # 2 python3.11-${PYTHON_VERSION}/debian python${PYTHON_BASE_VERSION}

    if ! apt list | grep valgrind-if-available; then
    # What's the point of making a metapackage that points to
    # that one, single package.
    sed -i 's/valgrind-if-available/valgrind/' control
    if apt show valgrind &>/dev/null; then
    sed -i 's/valgrind-if-available/valgrind/' control
    else
    sed -i 's/valgrind-if-available//' control
    fi
    fi

    popd # 1 python${PYTHON_BASE_VERSION}

    # Building meta package for installing build dependencies
    # Installing build dependencies
    mk-build-deps python3.11-${PYTHON_VERSION}/debian/control
    apt install -y ./python3.11-build-deps_${PYTHON_VERSION}-${PYTHON_RELEASE_ID}_$(dpkg-architecture --query DEB_TARGET_ARCH_CPU).deb

    @@ -142,11 +152,12 @@ pushd python3.11-${PYTHON_VERSION} # 2 python3.11-${PYTHON_VERSION} python${PYTH
    # distro like Ubuntu 20.04 LTS doesn't have.
    dpkg-buildpackage -us -uc -d -j$(nproc)

    # Aaaaaand, a painfully slow process than just compile the
    # source code.
    # Aaaaaand, a painfully slow process than just compile the source code.
    # It takes hours for my AMD Ryzen 5900X machine to build this.

    popd # 1 python${PYTHON_BASE_VERSION}

    # Install packages for building stdlib extensions
    apt install -y $(find . \
    -name '*python3.11-dev*.deb' -or \
    -name '*python3.11_*.deb' -not -name 'idle*' -or \
    @@ -156,6 +167,10 @@ apt install -y $(find . \

    popd # 0

    ################################
    # Standard modules for Python
    ################################

    mkdir python3-stdlib-extensions

    pushd python3-stdlib-extensions # 1 python3-stdlib-extensions
    @@ -178,17 +193,27 @@ fi
    dget "$STDLIB_DSC_LINK" --build

    pushd python3-stdlib-extensions-${PYTHON_VERSION}/debian # 2 python3-stdlib-extensions-${PYTHON_VERSION}/debian python3-stdlib-extensions

    # Rename all python3-* packages to python3.11-*
    # Also the substitutions for package dependency written in rules.
    for f in rules control; do
    sed -i "s|python3:|python${PYTHON_BASE_VERSION}:|" $f
    sed -i "s|python3-|python${PYTHON_BASE_VERSION}-|" $f
    done
    cp control control.old
    cat control.old | perl -pe "s/python3-(?"'!'"stdlib)/python${PYTHON_BASE_VERSION}-/" > control
    rm control.old

    # Renaming dependent packages
    sed -i "s|python3-|python${PYTHON_BASE_VERSION}-|g" rules
    sed -i "s|python3 |python${PYTHON_BASE_VERSION} |g" rules
    sed -i "s|python3:any|python${PYTHON_BASE_VERSION}:any|g" rules

    # Assign PYVERS to full version number so that $* will be PYTHON_BASE_VERSION
    sed -i "s|PYVERS *= *${PYTHON_BASE_VERSION}|PYVERS = ${PYTHON_VERSION}|" rules

    # Rename files, as filenames in rules changes
    for f in $(ls -d ./python3*); do
    mv "$f" $(echo "$f" | sed "s/python3/python${PYTHON_BASE_VERSION}/")
    done
    popd
    popd # 1 python3-stdlib-extensions

    # Install dependencies
    mk-build-deps python3-stdlib-extensions-${PYTHON_VERSION}/debian/control
    apt install -y ./python3-stdlib-extensions-build-deps_${PYTHON_VERSION}-${STDLIB_RELEASE_ID}_all.deb

  6. jacky9813 revised this gist Sep 23, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion building-python3.11.md
    Original file line number Diff line number Diff line change
    @@ -129,7 +129,7 @@ popd # 1 python${PYTHON_BASE_VERSION}

    # Building meta package for installing build dependencies
    mk-build-deps python3.11-${PYTHON_VERSION}/debian/control
    apt install ./python3.11-build-deps_${PYTHON_VERSION}-${PYTHON_RELEASE_ID}_$(dpkg-architecture --query DEB_TARGET_ARCH_CPU).deb
    apt install -y ./python3.11-build-deps_${PYTHON_VERSION}-${PYTHON_RELEASE_ID}_$(dpkg-architecture --query DEB_TARGET_ARCH_CPU).deb

    # Sphinx 3.2 is required when buliding documents.
    pip3 install Sphinx==3.2
  7. jacky9813 revised this gist Sep 23, 2023. 1 changed file with 12 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions building-python3.11.md
    Original file line number Diff line number Diff line change
    @@ -177,6 +177,18 @@ fi

    dget "$STDLIB_DSC_LINK" --build

    pushd python3-stdlib-extensions-${PYTHON_VERSION}/debian # 2 python3-stdlib-extensions-${PYTHON_VERSION}/debian python3-stdlib-extensions
    # Rename all python3-* packages to python3.11-*
    # Also the substitutions for package dependency written in rules.
    for f in rules control; do
    sed -i "s|python3:|python${PYTHON_BASE_VERSION}:|" $f
    sed -i "s|python3-|python${PYTHON_BASE_VERSION}-|" $f
    done
    for f in $(ls -d ./python3*); do
    mv "$f" $(echo "$f" | sed "s/python3/python${PYTHON_BASE_VERSION}/")
    done
    popd

    mk-build-deps python3-stdlib-extensions-${PYTHON_VERSION}/debian/control
    apt install -y ./python3-stdlib-extensions-build-deps_${PYTHON_VERSION}-${STDLIB_RELEASE_ID}_all.deb

  8. jacky9813 revised this gist Sep 23, 2023. 1 changed file with 11 additions and 11 deletions.
    22 changes: 11 additions & 11 deletions building-python3.11.md
    Original file line number Diff line number Diff line change
    @@ -80,7 +80,7 @@ Tests result: SUCCESS

    Note: Still under testing in [ubuntu:20.04](https://hub.docker.com/_/ubuntu). Testing in debian:10 or debian:11 is planned.

    ```bash#!/bin/bash
    ```bash
    #!/bin/bash
    source /etc/os-release
    # Both Debian and Ubuntu have official Python 3.11.2-6 release
    @@ -99,7 +99,7 @@ apt install -y build-essential devscripts equivs debian-keyring python3-pip

    mkdir python${PYTHON_BASE_VERSION}

    pushd python${PYTHON_BASE_VERSION}
    pushd python${PYTHON_BASE_VERSION} # 1 python${PYTHON_BASE_VERSION}

    # For Debian users, find dsc files from Debian Package Tracker:
    # https://tracker.debian.org/pkg/python3.11
    @@ -117,15 +117,15 @@ fi

    dget "$DSC_LINK" --build

    pushd python3.11-${PYTHON_VERSION}/debian
    pushd python3.11-${PYTHON_VERSION}/debian # 2 python3.11-${PYTHON_VERSION}/debian python${PYTHON_BASE_VERSION}

    if ! apt list | grep valgrind-if-available; then
    # What's the point of making a metapackage that points to
    # that one, single package.
    sed -i 's/valgrind-if-available/valgrind/' control
    fi

    popd # python3.11-${PYTHON_VERSION}/debian
    popd # 1 python${PYTHON_BASE_VERSION}

    # Building meta package for installing build dependencies
    mk-build-deps python3.11-${PYTHON_VERSION}/debian/control
    @@ -134,7 +134,7 @@ apt install ./python3.11-build-deps_${PYTHON_VERSION}-${PYTHON_RELEASE_ID}_$(dpk
    # Sphinx 3.2 is required when buliding documents.
    pip3 install Sphinx==3.2

    pushd python3.11-${PYTHON_VERSION}
    pushd python3.11-${PYTHON_VERSION} # 2 python3.11-${PYTHON_VERSION} python${PYTHON_BASE_VERSION}


    # Put -d here so that check will bypass checking if
    @@ -145,7 +145,7 @@ dpkg-buildpackage -us -uc -d -j$(nproc)
    # Aaaaaand, a painfully slow process than just compile the
    # source code.

    popd # python3.11-${PYTHON_VERSION}
    popd # 1 python${PYTHON_BASE_VERSION}

    apt install -y $(find . \
    -name '*python3.11-dev*.deb' -or \
    @@ -154,11 +154,11 @@ apt install -y $(find . \
    -name '*python3.11-minimal*.deb' -or \
    -name '*python3.11-dbg*.deb')

    popd #
    popd # 0

    mkdir python3-stdlib-extensions

    pushd python3-stdlib-extensions
    pushd python3-stdlib-extensions # 1 python3-stdlib-extensions

    # For Debian users, find dsc files from Debian Package Tracker:
    # https://tracker.debian.org/pkg/python3-stdlib-extensions
    @@ -180,12 +180,12 @@ dget "$STDLIB_DSC_LINK" --build
    mk-build-deps python3-stdlib-extensions-${PYTHON_VERSION}/debian/control
    apt install -y ./python3-stdlib-extensions-build-deps_${PYTHON_VERSION}-${STDLIB_RELEASE_ID}_all.deb

    pushd python3-stdlib-extensions-${PYTHON_VERSION}
    pushd python3-stdlib-extensions-${PYTHON_VERSION} # 2 python3-stdlib-extensions-${PYTHON_VERSION} python3-stdlib-extensions

    dpkg-buildpackage -us -uc -j$(nproc)

    popd #python3-stdlib-extensions-${PYTHON_VERSION} python3-stdlib-extensions
    popd #python3-stdlib-extensions
    popd # 1 python3-stdlib-extensions
    popd # 0

    find . -name '*.deb' -exec mv {} ./ \;
    ```
  9. jacky9813 revised this gist Sep 23, 2023. 1 changed file with 60 additions and 14 deletions.
    74 changes: 60 additions & 14 deletions building-python3.11.md
    Original file line number Diff line number Diff line change
    @@ -81,12 +81,14 @@ Tests result: SUCCESS
    Note: Still under testing in [ubuntu:20.04](https://hub.docker.com/_/ubuntu). Testing in debian:10 or debian:11 is planned.

    ```bash#!/bin/bash
    #!/bin/bash
    source /etc/os-release
    # Both Debian and Ubuntu have official Python 3.11.2-6 release
    # It is suggested to stick with that.
    PYTHON_BASE_VERSION=3.11
    PYTHON_VERSION=${PYTHON_BASE_VERSION}.2
    RELEASE_ID=6
    PYTHON_RELEASE_ID=6
    STDLIB_RELEASE_ID=3
    TIMEZONE=Etc/UTC
    # Configure /etc/localtime so apt won't ask anything when installing tzdata
    @@ -95,44 +97,46 @@ ln -s /usr/share/zoneinfo/${TIMEZONE} /etc/localtime
    apt update
    apt install -y build-essential devscripts equivs debian-keyring python3-pip
    mkdir python${PYTHON_BASE_VERSION}
    pushd python${PYTHON_BASE_VERSION}
    # For Debian users, find dsc files from Debian Package Tracker:
    # https://tracker.debian.org/pkg/python3.11
    #
    # For Ubuntu users, find dsc files from Launchpad:
    # https://launchpad.net/ubuntu/+source/python3.11
    DSC_LINK=https://deb.debian.org/debian/pool/main/p/python${PYTHON_BASE_VERSION}/python${PYTHON_BASE_VERSION}_${PYTHON_VERSION}-${RELEASE_ID}.dsc
    DSC_LINK=https://deb.debian.org/debian/pool/main/p/python${PYTHON_BASE_VERSION}/python${PYTHON_BASE_VERSION}_${PYTHON_VERSION}-${PYTHON_RELEASE_ID}.dsc
    if [ "$ID" == "ubuntu" ]; then
    DSC_LINK=https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/python${PYTHON_BASE_VERSION}/${PYTHON_VERSION}-${RELEASE_ID}/python${PYTHON_BASE_VERSION}_${PYTHON_VERSION}-${RELEASE_ID}.dsc
    DSC_LINK=https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/python${PYTHON_BASE_VERSION}/${PYTHON_VERSION}-${PYTHON_RELEASE_ID}/python${PYTHON_BASE_VERSION}_${PYTHON_VERSION}-${PYTHON_RELEASE_ID}.dsc
    elif [ "$ID" != "debian" ]; then
    echo "Unknown distro $ID. Using source code from Debian."
    fi
    dget "$DSC_LINK" --build
    pushd python3.11-${PYTHON_VERSION}
    pushd debian
    pushd python3.11-${PYTHON_VERSION}/debian
    if ! apt list | grep valgrind-if-available; then
    # What's the point of making a metapackage that points to
    # that one, single package.
    sed -i 's/valgrind-if-available/valgrind/' control
    fi
    # Building meta package for installing build dependencies
    mk-build-deps control
    apt install ./python3.11-build-deps_${PYTHON_VERSION}-${RELEASE_ID}_$(dpkg-architecture --query DEB_TARGET_ARCH_CPU).deb
    # dpkg-buildpackage doesn't like any unknown package file at all.
    rm ./python3.11-build-deps_${PYTHON_VERSION}-${RELEASE_ID}_$(dpkg-architecture --query DEB_TARGET_ARCH_CPU).deb
    popd # python3.11-${PYTHON_VERSION}/debian
    popd
    # Building meta package for installing build dependencies
    mk-build-deps python3.11-${PYTHON_VERSION}/debian/control
    apt install ./python3.11-build-deps_${PYTHON_VERSION}-${PYTHON_RELEASE_ID}_$(dpkg-architecture --query DEB_TARGET_ARCH_CPU).deb
    # Sphinx 3.2 is required when buliding documents.
    pip3 install Sphinx==3.2
    pushd python3.11-${PYTHON_VERSION}
    # Put -d here so that check will bypass checking if
    # valgrind-if-available is installed, which a little older
    # distro like Ubuntu 20.04 LTS doesn't have.
    @@ -141,7 +145,49 @@ dpkg-buildpackage -us -uc -d -j$(nproc)
    # Aaaaaand, a painfully slow process than just compile the
    # source code.
    popd
    popd # python3.11-${PYTHON_VERSION}
    apt install -y $(find . \
    -name '*python3.11-dev*.deb' -or \
    -name '*python3.11_*.deb' -not -name 'idle*' -or \
    -name 'libpython3.11-stdlib*.deb' -or \
    -name '*python3.11-minimal*.deb' -or \
    -name '*python3.11-dbg*.deb')
    popd #
    mkdir python3-stdlib-extensions
    pushd python3-stdlib-extensions
    # For Debian users, find dsc files from Debian Package Tracker:
    # https://tracker.debian.org/pkg/python3-stdlib-extensions
    #
    # For Ubuntu users, find dsc files from Launchpad:
    # https://launchpad.net/ubuntu/+source/python3-stdlib-extensions
    STDLIB_DSC_LINK=https://deb.debian.org/debian/pool/main/p/python3-stdlib-extensions/python3-stdlib-extensions_${PYTHON_VERSION}-${STDLIB_RELEASE_ID}.dsc
    if [ "$ID" == "ubuntu" ]; then
    STDLIB_DSC_LINK=https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/python3-stdlib-extensions/${PYTHON_VERSION}-${STDLIB_RELEASE_ID}/python3-stdlib-extensions_${PYTHON_VERSION}-${STDLIB_RELEASE_ID}.dsc
    elif [ "$ID" != "debian" ]; then
    echo "Unknown distro $ID. Using source code from Debian."
    fi
    dget "$STDLIB_DSC_LINK" --build
    mk-build-deps python3-stdlib-extensions-${PYTHON_VERSION}/debian/control
    apt install -y ./python3-stdlib-extensions-build-deps_${PYTHON_VERSION}-${STDLIB_RELEASE_ID}_all.deb
    pushd python3-stdlib-extensions-${PYTHON_VERSION}
    dpkg-buildpackage -us -uc -j$(nproc)
    popd #python3-stdlib-extensions-${PYTHON_VERSION} python3-stdlib-extensions
    popd #python3-stdlib-extensions
    find . -name '*.deb' -exec mv {} ./ \;
    ```

    ## CentOS 7
  10. jacky9813 revised this gist Sep 23, 2023. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions building-python3.11.md
    Original file line number Diff line number Diff line change
    @@ -27,6 +27,9 @@ default `python` or `python3` command.

    ## Debian 10+, Ubuntu 18.04+

    IMPORTANT: Debian 12 Bookworm has `python3` that is Python 3.11.
    BEWARE THAT IT MAY GET VERY CONFUSING IF MULTIPLE PYTHON 3.11 BUILDS ARE INSTALLED.

    ### Normal Install

    Tested in [debian:buster](https://hub.docker.com/_/debian) and [ubuntu:20.04](https://hub.docker.com/_/ubuntu).
  11. jacky9813 revised this gist Sep 23, 2023. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions building-python3.11.md
    Original file line number Diff line number Diff line change
    @@ -560,6 +560,9 @@ Tests result: FAILURE then FAILURE

    ## openSUSE Leap 15

    IMPORTANT: SUSE 15 has `python311` package in Updates from SLES 15 repo.
    BEWARE THAT IT MAY GET VERY CONFUSING IF MULTIPLE PYTHON 3.11 BUILDS ARE INSTALLED.

    Tested in [opensuse/leap:15.5](https://hub.docker.com/r/opensuse/leap).

    ```bash
    @@ -725,6 +728,9 @@ export PATH="$PATH:/opt/python/3.11.5-opensuse42-x86_64/bin"

    ## Alpine Linux 3.18

    IMPORTANT: Alpine has `python3` package that can be Python 3.11.
    BEWARE THAT IT MAY GET VERY CONFUSING IF MULTIPLE PYTHON 3.11 BUILDS ARE INSTALLED.

    Tested with [alpine:3.18](https://hub.docker.com/_/alpine).

    The package release cycle for Alpine Linux is really fast, consider using `apk add python3`
  12. jacky9813 revised this gist Sep 23, 2023. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions building-python3.11.md
    Original file line number Diff line number Diff line change
    @@ -365,6 +365,9 @@ fi

    ## Rocky Linux 8

    IMPORTANT: EL8, or at least Rocky Linux 8, has `python3.11` package in App Stream repo.
    BEWARE THAT IT MAY GET VERY CONFUSING IF MULTIPLE PYTHON 3.11 BUILDS ARE INSTALLED.

    Tested in [rockylinux:8](https://hub.docker.com/_/rockylinux)

    ~~The script should work in RHEL8 based systems.~~
    @@ -459,6 +462,9 @@ Tests result: FAILURE then FAILURE

    ## Rocky Linux 9

    IMPORTANT: EL9, or at least Rocky Linux 9, has `python3.11` package in App Stream repo.
    BEWARE THAT IT MAY GET VERY CONFUSING IF MULTIPLE PYTHON 3.11 BUILDS ARE INSTALLED.

    Tested in [rockylinux:9](https://hub.docker.com/_/rockylinux)

    ~~The script should work in RHEL9 based systems.~~
  13. jacky9813 revised this gist Sep 23, 2023. 1 changed file with 17 additions and 4 deletions.
    21 changes: 17 additions & 4 deletions building-python3.11.md
    Original file line number Diff line number Diff line change
    @@ -77,11 +77,17 @@ Tests result: SUCCESS

    Note: Still under testing in [ubuntu:20.04](https://hub.docker.com/_/ubuntu). Testing in debian:10 or debian:11 is planned.

    ```bash
    #!/bin/bash
    ```bash#!/bin/bash
    source /etc/os-release
    # Both Debian and Ubuntu have official Python 3.11.2-6 release
    # It is suggested to stick with that.
    PYTHON_BASE_VERSION=3.11
    PYTHON_VERSION=${PYTHON_BASE_VERSION}.2
    RELEASE_ID=6
    TIMEZONE=Etc/UTC
    # Configure /etc/localtime so apt won't ask anything when installing tzdata
    ln -s /usr/share/zoneinfo/${TIMEZONE} /etc/localtime
    apt update
    apt install -y build-essential devscripts equivs debian-keyring python3-pip
    @@ -92,8 +98,15 @@ apt install -y build-essential devscripts equivs debian-keyring python3-pip
    # For Ubuntu users, find dsc files from Launchpad:
    # https://launchpad.net/ubuntu/+source/python3.11
    DSC_LINK=https://deb.debian.org/debian/pool/main/p/python${PYTHON_BASE_VERSION}/python${PYTHON_BASE_VERSION}_${PYTHON_VERSION}-${RELEASE_ID}.dsc
    if [ "$ID" == "ubuntu" ]; then
    DSC_LINK=https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/python${PYTHON_BASE_VERSION}/${PYTHON_VERSION}-${RELEASE_ID}/python${PYTHON_BASE_VERSION}_${PYTHON_VERSION}-${RELEASE_ID}.dsc
    elif [ "$ID" != "debian" ]; then
    echo "Unknown distro $ID. Using source code from Debian."
    fi
    dget https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/python${PYTHON_BASE_VERSION}/${PYTHON_VERSION}-${RELEASE_ID}/python${PYTHON_BASE_VERSION}_${PYTHON_VERSION}-${RELEASE_ID}.dsc --build
    dget "$DSC_LINK" --build
    pushd python3.11-${PYTHON_VERSION}
    @@ -115,7 +128,7 @@ rm ./python3.11-build-deps_${PYTHON_VERSION}-${RELEASE_ID}_$(dpkg-architecture -
    popd
    # Sphinx 3.2 is required when buliding documents.
    pip3 install Sphinx
    pip3 install Sphinx==3.2
    # Put -d here so that check will bypass checking if
    # valgrind-if-available is installed, which a little older
  14. jacky9813 revised this gist Sep 23, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion building-python3.11.md
    Original file line number Diff line number Diff line change
    @@ -97,7 +97,7 @@ dget https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/python${PYTHON_B

    pushd python3.11-${PYTHON_VERSION}

    push debian
    pushd debian

    if ! apt list | grep valgrind-if-available; then
    # What's the point of making a metapackage that points to
  15. jacky9813 revised this gist Sep 22, 2023. 1 changed file with 57 additions and 0 deletions.
    57 changes: 57 additions & 0 deletions building-python3.11.md
    Original file line number Diff line number Diff line change
    @@ -27,6 +27,8 @@ default `python` or `python3` command.

    ## Debian 10+, Ubuntu 18.04+

    ### Normal Install

    Tested in [debian:buster](https://hub.docker.com/_/debian) and [ubuntu:20.04](https://hub.docker.com/_/ubuntu).

    * Note: For Ubuntu 18.04 with both packages `tk-dev` (8.6.0+9) and `tk8.6-dev` (8.6.8-4)
    @@ -71,6 +73,61 @@ Total duration: 2 min 13 sec
    Tests result: SUCCESS
    ```

    ### Build DEB Package

    Note: Still under testing in [ubuntu:20.04](https://hub.docker.com/_/ubuntu). Testing in debian:10 or debian:11 is planned.

    ```bash
    #!/bin/bash
    PYTHON_BASE_VERSION=3.11
    PYTHON_VERSION=${PYTHON_BASE_VERSION}.2
    RELEASE_ID=6

    apt update
    apt install -y build-essential devscripts equivs debian-keyring python3-pip

    # For Debian users, find dsc files from Debian Package Tracker:
    # https://tracker.debian.org/pkg/python3.11
    #
    # For Ubuntu users, find dsc files from Launchpad:
    # https://launchpad.net/ubuntu/+source/python3.11


    dget https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/python${PYTHON_BASE_VERSION}/${PYTHON_VERSION}-${RELEASE_ID}/python${PYTHON_BASE_VERSION}_${PYTHON_VERSION}-${RELEASE_ID}.dsc --build

    pushd python3.11-${PYTHON_VERSION}

    push debian

    if ! apt list | grep valgrind-if-available; then
    # What's the point of making a metapackage that points to
    # that one, single package.
    sed -i 's/valgrind-if-available/valgrind/' control
    fi

    # Building meta package for installing build dependencies
    mk-build-deps control
    apt install ./python3.11-build-deps_${PYTHON_VERSION}-${RELEASE_ID}_$(dpkg-architecture --query DEB_TARGET_ARCH_CPU).deb

    # dpkg-buildpackage doesn't like any unknown package file at all.
    rm ./python3.11-build-deps_${PYTHON_VERSION}-${RELEASE_ID}_$(dpkg-architecture --query DEB_TARGET_ARCH_CPU).deb

    popd

    # Sphinx 3.2 is required when buliding documents.
    pip3 install Sphinx

    # Put -d here so that check will bypass checking if
    # valgrind-if-available is installed, which a little older
    # distro like Ubuntu 20.04 LTS doesn't have.
    dpkg-buildpackage -us -uc -d -j$(nproc)

    # Aaaaaand, a painfully slow process than just compile the
    # source code.

    popd
    ```

    ## CentOS 7

    Tested on [centos:7](https://hub.docker.com/_/centos)
  16. jacky9813 revised this gist Sep 21, 2023. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion building-python3.11.md
    Original file line number Diff line number Diff line change
    @@ -85,7 +85,14 @@ more attractive for enterprise users than ever.

    * Note: `_tkinter` module is not available because Python 3.11 requires tk 8.6, while
    package `tk-devel` is using tk 8.5.


    ### Build RPM

    Checkout my repo about [building Python 3.10 for EL7](https://github.com/jacky9813/python3.10-el7).

    That being said, since that is focus on Python 3.10, it may require changes here and there, so
    use it carefully.

    ### Normal Install

    ```bash
  17. jacky9813 revised this gist Sep 19, 2023. 1 changed file with 115 additions and 0 deletions.
    115 changes: 115 additions & 0 deletions building-python3.11.md
    Original file line number Diff line number Diff line change
    @@ -85,6 +85,8 @@ more attractive for enterprise users than ever.

    * Note: `_tkinter` module is not available because Python 3.11 requires tk 8.6, while
    package `tk-devel` is using tk 8.5.

    ### Normal Install

    ```bash
    #!/bin/bash
    @@ -171,6 +173,119 @@ Tests result: FAILURE then SUCCESS
    * `test_gdb` will be ignored as test script detects CentOS 7 official `gdb` package is
    compiled with Python 2.

    ### Distributable Tarball

    #### Build

    ```bash
    #!/bin/bash
    source /etc/os-release
    PYTHON_VERSION=3.11.5
    OPENSSL_VERSION=1.1.1w
    OPENSSL_SHA256=cf3098950cb4d853ad95c0841f1f9c6d3dc102dccfcacd521d93925208b76ac8

    yum install -y epel-release
    yum install -y ncurses-devel bzip2-devel gdbm-devel xz-devel zlib-devel \
    libuuid-devel readline-devel sqlite-devel libffi-devel \
    gcc make automake perl-core pkgconfig nasm curl

    # For unknown reason, build process wouldn't pick up openssl11-devel package
    # when prefix is set.
    # I have to build my own OpenSSL here.

    # Also, the certificate for www.openssl.org cannot be verified by
    # curl or wget for some reason.
    curl -Ok https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz
    if echo "${OPENSSL_SHA256} openssl-${OPENSSL_VERSION}.tar.gz" | sha256sum -c; then
    tar xvf openssl-${OPENSSL_VERSION}.tar.gz
    pushd openssl-${OPENSSL_VERSION}
    ./config --prefix=/opt/python/${PYTHON_VERSION}-el${VERSION_ID}.$(uname -m) --openssldir=/opt/python/${PYTHON_VERSION}-el${VERSION_ID}.$(uname -m)
    make -j$(nproc)
    make install_sw
    popd
    else
    echo "SHA256 check failed"
    exit 1
    fi

    # Build Python
    curl -O https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz
    tar -xvf Python-${PYTHON_VERSION}.tgz
    pushd Python-${PYTHON_VERSION}
    ./configure \
    --enable-loadable-sqlite-extensions \
    --prefix=/opt/python/${PYTHON_VERSION}-el${VERSION_ID}.$(uname -m) \
    --with-openssl=/opt/python/${PYTHON_VERSION}-el${VERSION_ID}.$(uname -m) \
    --with-openssl-rpath=auto
    make -j$(nproc)
    make install
    popd
    ```

    #### Install

    ```bash
    #!/bin/bash

    # Basic setup
    source /etc/os-release
    PYTHON_INSTALL_BASE=/opt/python
    PYTHON_VERSION=3.10
    PYTHON_FULL_VERSION=${PYTHON_VERSION}.13
    PYTHON_INSTALL_VERSION=${PYTHON_FULL_VERSION}-el${VERSION_ID}.$(uname -m)

    # Make this variable empty for not to create symbolic link to installed Python
    # MKLINK_TO_LOCAL_BIN=
    MKLINK_TO_LOCAL_BIN=1

    if ! [ -d ${PYTHON_INSTALL_BASE}/${PYTHON_INSTALL_VERSION} ]; then
    # Installing dependencies
    yum install -y epel-release
    # It is not required to install openssl11-libs as OpenSSL 1.1.1 came bundled.
    yum install -y ncurses-libs bzip2-libs gdbm xz-libs libuuid readline sqlite libffi

    # Install Python
    install -d ${PYTHON_INSTALL_BASE}
    tar xvf python-${PYTHON_INSTALL_VERSION}.tar.gz -C ${PYTHON_INSTALL_BASE}

    # Configure PATH
    echo "export PATH=\"\$PATH:${PYTHON_INSTALL_BASE}/${PYTHON_INSTALL_VERSION}/bin\"" | tee /etc/profile.d/python3.10.sh
    . /etc/profile
    if [ -f ~/.bashrc ]; then
    . ~/.bashrc
    fi

    if ! [ -z "$MKLINK_TO_LOCAL_BIN" ]; then
    for program in 2to3-3.10 pip3.10 pydoc3.10 python3.10 python3.10-config; do
    if [ -L /usr/local/bin/${program} ] ; then
    rm -rv /usr/local/bin/${program}
    fi
    ln -sv ${PYTHON_INSTALL_BASE}/${PYTHON_INSTALL_VERSION}/bin/${program} /usr/local/bin/${program}
    done
    fi

    # Links for pkgconfig
    LIB=lib
    if uname -m | grep 64 > /dev/null && [ -d /usr/lib64/pkgconfig ] ; then
    LIB=lib64
    fi
    ln -sv ${PYTHON_INSTALL_BASE}/${PYTHON_INSTALL_VERSION}/lib/pkgconfig/python-3.10.pc /usr/${LIB}/pkgconfig/python-3.10.pc

    # Links for includes
    if [ -L /usr/local/include/python${PYTHON_VERSION} ]; then
    rm -fv /usr/local/include/python${PYTHON_VERSION}
    fi
    ln -sv ${PYTHON_INSTALL_BASE}/${PYTHON_INSTALL_VERSION}/include/python${PYTHON_VERSION} /usr/local/include/python${PYTHON_VERSION}

    # Install man page for python if system has man and no python pages available.
    if which man &> /dev/null && ! man -k python &> /dev/null ; then
    ln -sv $(find ${PYTHON_INSTALL_BASE}/${PYTHON_INSTALL_VERSION}/share/man/man1 -type f) /usr/local/share/man/man1/python${PYTHON_VERSION}
    fi
    else
    echo ${PYTHON_INSTALL_VERSION} has already been installed.
    fi
    ```

    ## Rocky Linux 8

    Tested in [rockylinux:8](https://hub.docker.com/_/rockylinux)
  18. jacky9813 revised this gist Sep 19, 2023. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions building-python3.11.md
    Original file line number Diff line number Diff line change
    @@ -99,9 +99,9 @@ tar -xvf Python-${PYTHON_VERSION}.tgz
    pushd Python-${PYTHON_VERSION}
    # Hats off to Yebolin https://github.com/pyenv/pyenv/issues/2416#issuecomment-1207579730
    # openssl11-devel is in epel
    CFLAGS="$CFLAGS $(pkg-config --cflags openssl11)" \
    LDFLAGS="$LDFLAGS $(pkg-config --libs openssl11)" \
    ./configure --enable-loadable-sqlite-extensions
    export CFLAGS="$CFLAGS $(pkg-config --cflags openssl11)"
    export LDFLAGS="$LDFLAGS $(pkg-config --libs openssl11)"
    ./configure --enable-loadable-sqlite-extensions
    make -j$(nproc)
    make altinstall
    popd
  19. jacky9813 revised this gist Sep 14, 2023. 1 changed file with 33 additions and 4 deletions.
    37 changes: 33 additions & 4 deletions building-python3.11.md
    Original file line number Diff line number Diff line change
    @@ -532,9 +532,6 @@ Tested with [alpine:3.18](https://hub.docker.com/_/alpine).
    The package release cycle for Alpine Linux is really fast, consider using `apk add python3`
    to install officially supported Python.

    Note: When trying `make test`, multiple tests will fail due to locales or codec not exist,
    even with package `musl-locales` installed.

    ``` bash
    apk add musl-dev ncurses-dev bzip2-dev gdbm-dev libnsl-dev xz-dev openssl3-dev tk-dev libuuid \
    readline-dev sqlite-dev libffi-dev gcc make automake wget tar gzip
    @@ -544,4 +541,36 @@ cd Python-3.11.0
    ./configure --enable-loadable-sqlite-extensions
    make -j$(nproc)
    make altinstall
    ```
    ```

    Testing (before `make altinstall`)

    ```sh
    #!/bin/sh
    apk add gdb g++ musl-locales musl-locales-lang
    make test
    ```

    ```
    == Tests result: FAILURE then FAILURE ==
    415 tests OK.
    5 tests failed:
    test__locale test_c_locale_coercion test_locale test_os test_re
    14 tests skipped:
    test_devpoll test_ioctl test_kqueue test_launcher test_msilib
    test_ossaudiodev test_startfile test_tix test_tk test_ttk_guionly
    test_winconsoleio test_winreg test_winsound test_zipfile64
    6 re-run tests:
    test__locale test_c_locale_coercion test_locale test_os test_re
    test_tools
    Total duration: 3 min 26 sec
    Tests result: FAILURE then FAILURE
    ```

    * Seems like CPython doesn't like i18n implementation in musl, all failures are related
    to locales and charmaps.
  20. jacky9813 revised this gist Sep 14, 2023. 1 changed file with 4 additions and 7 deletions.
    11 changes: 4 additions & 7 deletions building-python3.11.md
    Original file line number Diff line number Diff line change
    @@ -27,7 +27,7 @@ default `python` or `python3` command.

    ## Debian 10+, Ubuntu 18.04+

    Tested in [debian:buster](https://hub.docker.com/_/debian).
    Tested in [debian:buster](https://hub.docker.com/_/debian) and [ubuntu:20.04](https://hub.docker.com/_/ubuntu).

    * Note: For Ubuntu 18.04 with both packages `tk-dev` (8.6.0+9) and `tk8.6-dev` (8.6.8-4)
    installed, `_tkinter` module is refused to compile for unknown reason.
    @@ -58,7 +58,7 @@ make test
    ```

    ```
    == Tests result: FAILURE then SUCCESS ==
    == Tests result: SUCCESS ==
    420 tests OK.
    @@ -67,11 +67,8 @@ make test
    test_ossaudiodev test_startfile test_tix test_tk test_ttk_guionly
    test_winconsoleio test_winreg test_winsound test_zipfile64
    1 re-run test:
    test_nntplib
    Total duration: 5 min 32 sec
    Tests result: FAILURE then SUCCESS
    Total duration: 2 min 13 sec
    Tests result: SUCCESS
    ```

    ## CentOS 7
  21. jacky9813 revised this gist Sep 14, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion building-python3.11.md
    Original file line number Diff line number Diff line change
    @@ -23,7 +23,7 @@ default `python` or `python3` command.
    * [Rocky Linux 9](#rocky-linux-9)
    * [openSUSE Leap 15](#opensuse-leap-15)
    * [openSUSE Leap 42](#opensuse-leap-42)
    * [Alpine Linux 3.16.2](#alpine-linux-3162)
    * [Alpine Linux 3.18](#alpine-linux-318)

    ## Debian 10+, Ubuntu 18.04+

  22. jacky9813 revised this gist Sep 14, 2023. 1 changed file with 80 additions and 10 deletions.
    90 changes: 80 additions & 10 deletions building-python3.11.md
    Original file line number Diff line number Diff line change
    @@ -19,7 +19,7 @@ default `python` or `python3` command.

    * [Debian 10+, Ubuntu 18.04+](#debian-10-ubuntu-1804)
    * [CentOS 7](#centos-7)
    * [AlmaLinux 8](#almalinux-8)
    * [Rocky Linux 8](#rocky-linux-8)
    * [Rocky Linux 9](#rocky-linux-9)
    * [openSUSE Leap 15](#opensuse-leap-15)
    * [openSUSE Leap 42](#opensuse-leap-42)
    @@ -270,6 +270,8 @@ Tests result: FAILURE then FAILURE

    ## Rocky Linux 9

    Tested in [rockylinux:9](https://hub.docker.com/_/rockylinux)

    ~~The script should work in RHEL9 based systems.~~

    _Update on Jun 26, 2023_: Thanks to the [decision from Red Hat](https://www.redhat.com/en/blog/furthering-evolution-centos-stream),
    @@ -279,19 +281,87 @@ Also, well done to someone that came up with that decision, making Canonical's U
    Server more attractive for enterprise users than ever.

    ```bash
    #!/bin/bash
    PYTHON_VERSION=3.11.5

    # gdbm-devel and libnsl2-devel in CRB for Rocky Linux 9
    sudo dnf install -y 'dnf-command(config-manager)'
    sudo dnf config-manager --set-enabled crb
    sudo dnf install -y ncurses-devel bzip2-devel gdbm-devel libnsl2-devel xz-devel \
    openssl-devel tk-devel libuuid-devel readline-devel sqlite-devel \
    libffi-devel gcc make automake wget
    wget https://www.python.org/ftp/python/3.11.0/Python-3.11.0.tgz
    tar -xvf Python-3.11.0.tgz
    cd Python-3.11.0
    dnf install -y 'dnf-command(config-manager)'
    dnf config-manager --set-enabled crb
    dnf install -y ncurses-devel bzip2-devel gdbm-devel libnsl2-devel xz-devel \
    openssl-devel tk-devel libuuid-devel readline-devel sqlite-devel \
    libffi-devel gcc make automake wget
    wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz
    tar -xvf Python-${PYTHON_VERSION}.tgz
    cd Python-${PYTHON_VERSION}
    ./configure --enable-loadable-sqlite-extensions
    make -j$(nproc)
    sudo make altinstall
    make altinstall
    ```

    Testing (before `make install`)

    ```bash
    dnf install -y gdb gcc-c++ findutils glibc-locale-source

    pushd /usr/share/i18n/charmaps
    for charmap_file in $(ls *.gz); do
    gzip -d $charmap_file
    done
    popd

    pushd Lib/test
    TESTED_LOCALES=$(../../python -c 'import test__locale; print(" ".join(test__locale.candidate_locales))')
    popd

    # Building Locales for testing
    for locale_id in $TESTED_LOCALES; do
    locale=$(echo $locale_id | sed 's/\..*//')
    charmap=$(echo $locale_id | grep '\.' | sed 's/^.*\.//' | sed 's/@.*//')
    variant=$(echo $locale_id | grep '@' | sed 's/.*@//')
    charmap=${charmap:-UTF-8}

    if echo $charmap | grep -E '^euc[A-Z]+$' &>/dev/null ; then
    charmap=$(echo $charmap | sed -E 's/euc([A-Z]+)/EUC-\1/')
    fi

    if echo $charmap | grep -E 'ISO[0-9]+.*' &>/dev/null ; then
    charmap=$(echo $charmap | sed 's/^ISO/ISO-/')
    fi

    echo "Building locale $locale_id"
    if ! [ -z "$variant" ]; then
    localedef -f ${charmap} -i ${locale}@${variant} $locale_id
    else
    localedef -f ${charmap} -i $locale $locale_id
    fi
    done

    dnf install -y glibc-langpack-*

    make test
    ```

    ```
    == Tests result: FAILURE then FAILURE ==
    419 tests OK.
    1 test failed:
    test__locale
    14 tests skipped:
    test_devpoll test_ioctl test_kqueue test_launcher test_msilib
    test_ossaudiodev test_startfile test_tix test_tk test_ttk_guionly
    test_winconsoleio test_winreg test_winsound test_zipfile64
    1 re-run test:
    test__locale
    Total duration: 2 min 39 sec
    Tests result: FAILURE then FAILURE
    ```

    * Just like Rocky Linux 8, having problem getting `test__locale` working.

    ## openSUSE Leap 15

  23. jacky9813 revised this gist Sep 14, 2023. 1 changed file with 11 additions and 8 deletions.
    19 changes: 11 additions & 8 deletions building-python3.11.md
    Original file line number Diff line number Diff line change
    @@ -187,18 +187,21 @@ Also, well done to someone that came up with that decision, making Canonical's U
    more attractive for enterprise users than ever.

    ```bash
    # libnsl2-devel in PowerTools for Alma Linux 8
    sudo dnf install -y 'dnf-command(config-manager)'
    sudo dnf config-manager --set-enabled powertools
    sudo dnf install -y ncurses-devel bzip2-devel gdbm-devel libnsl2-devel xz-devel \
    #!/bin/bash
    PYTHON_VERSION=3.11.5

    # libnsl2-devel in PowerTools for Rocky Linux 8
    dnf install -y 'dnf-command(config-manager)'
    dnf config-manager --set-enabled powertools
    dnf install -y ncurses-devel bzip2-devel gdbm-devel libnsl2-devel xz-devel \
    openssl-devel tk-devel libuuid-devel readline-devel sqlite-devel \
    libffi-devel gcc make automake wget
    wget https://www.python.org/ftp/python/3.11.0/Python-3.11.0.tgz
    tar -xvf Python-3.11.0.tgz
    cd Python-3.11.0
    wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz
    tar -xvf Python-${PYTHON_VERSION}.tgz
    cd Python-${PYTHON_VERSION}
    ./configure --enable-loadable-sqlite-extensions
    make -j$(nproc)
    sudo make altinstall
    make altinstall
    ```

    Testing (Before `make altinstall`)
  24. jacky9813 revised this gist Sep 14, 2023. 1 changed file with 71 additions and 5 deletions.
    76 changes: 71 additions & 5 deletions building-python3.11.md
    Original file line number Diff line number Diff line change
    @@ -47,7 +47,7 @@ make -j$(nproc)
    make altinstall
    ```

    Testing
    Testing (Before `make altinstall`)

    ```bash
    #!/bin/bash
    @@ -76,6 +76,8 @@ Tests result: FAILURE then SUCCESS

    ## CentOS 7

    Tested on [centos:7](https://hub.docker.com/_/centos)

    ~~The script should work with RHEL7 based systems.~~

    _Update on Jun 26, 2023_: Thanks to the [decision from Red Hat](https://www.redhat.com/en/blog/furthering-evolution-centos-stream),
    @@ -84,8 +86,6 @@ apply Red Hat developer subscription.
    Also, well done to someone that came up with that decision, making Canonical's Ubuntu Server
    more attractive for enterprise users than ever.

    Tested on [centos:7](https://hub.docker.com/_/centos)

    * Note: `_tkinter` module is not available because Python 3.11 requires tk 8.6, while
    package `tk-devel` is using tk 8.5.

    @@ -110,7 +110,7 @@ make altinstall
    popd
    ```

    Testing
    Testing (Before `make altinstall`)

    ```bash
    #!/bin/bash
    @@ -174,7 +174,9 @@ Tests result: FAILURE then SUCCESS
    * `test_gdb` will be ignored as test script detects CentOS 7 official `gdb` package is
    compiled with Python 2.

    ## Alma Linux 8
    ## Rocky Linux 8

    Tested in [rockylinux:8](https://hub.docker.com/_/rockylinux)

    ~~The script should work in RHEL8 based systems.~~

    @@ -198,6 +200,70 @@ cd Python-3.11.0
    make -j$(nproc)
    sudo make altinstall
    ```

    Testing (Before `make altinstall`)
    ```bash
    dnf install -y gdb gcc-c++ glibc-locale-source findutils

    pushd /usr/share/i18n/charmaps
    for charmap_file in $(ls *.gz); do
    gzip -d $charmap_file
    done
    popd

    pushd Lib/test
    TESTED_LOCALES=$(../../python -c 'import test__locale; print(" ".join(test__locale.candidate_locales))')
    popd

    # Building Locales for testing
    for locale_id in $TESTED_LOCALES; do
    locale=$(echo $locale_id | sed 's/\..*//')
    charmap=$(echo $locale_id | grep '\.' | sed 's/^.*\.//' | sed 's/@.*//')
    variant=$(echo $locale_id | grep '@' | sed 's/.*@//')
    charmap=${charmap:-UTF-8}

    if echo $charmap | grep -E '^euc[A-Z]+$' &>/dev/null ; then
    charmap=$(echo $charmap | sed -E 's/euc([A-Z]+)/EUC-\1/')
    fi

    if echo $charmap | grep -E 'ISO[0-9]+.*' &>/dev/null ; then
    charmap=$(echo $charmap | sed 's/^ISO/ISO-/')
    fi

    echo "Building locale $locale_id"
    if ! [ -z "$variant" ]; then
    localedef -f ${charmap} -i ${locale}@${variant} $locale_id
    else
    localedef -f ${charmap} -i $locale $locale_id
    fi
    done

    dnf install -y glibc-langpack-*

    make test
    ```

    ```
    == Tests result: FAILURE then FAILURE ==
    419 tests OK.
    1 test failed:
    test__locale
    14 tests skipped:
    test_devpoll test_ioctl test_kqueue test_launcher test_msilib
    test_ossaudiodev test_startfile test_tix test_tk test_ttk_guionly
    test_winconsoleio test_winreg test_winsound test_zipfile64
    2 re-run tests:
    test__locale test_tools
    Total duration: 3 min 2 sec
    Tests result: FAILURE then FAILURE
    ```

    * I'm having problem getting `test__locale` working, with or without `glibc-langpack-*` installed.

    ## Rocky Linux 9

  25. jacky9813 revised this gist Sep 14, 2023. 1 changed file with 81 additions and 12 deletions.
    93 changes: 81 additions & 12 deletions building-python3.11.md
    Original file line number Diff line number Diff line change
    @@ -84,27 +84,96 @@ apply Red Hat developer subscription.
    Also, well done to someone that came up with that decision, making Canonical's Ubuntu Server
    more attractive for enterprise users than ever.

    Tested on [centos:7](https://hub.docker.com/_/centos)

    * Note: `_tkinter` module is not available because Python 3.11 requires tk 8.6, while
    package `tk-devel` is using tk 8.5.

    ```bash
    # Hats off to Yebolin https://github.com/pyenv/pyenv/issues/2416#issuecomment-1207579730
    # openssl11-devel is in epel
    sudo yum install -y epel-release
    sudo yum install -y ncurses-devel bzip2-devel gdbm-devel libnsl2-devel xz-devel \
    #!/bin/bash
    PYTHON_VERSION=3.11.5

    yum install -y epel-release
    yum install -y ncurses-devel bzip2-devel gdbm-devel libnsl2-devel xz-devel \
    libuuid-devel readline-devel sqlite-devel libffi-devel \
    openssl11-devel gcc make automake wget perl-core pkgconfig
    export CFLAGS="$CFLAGS $(pkg-config --cflags openssl11)"
    export LDFLAGS="$LDFLAGS $(pkg-config --libs openssl11)"
    cd ~
    wget https://www.python.org/ftp/python/3.11.0/Python-3.11.0.tgz
    tar -xvf Python-3.11.0.tgz
    cd Python-3.11.0
    ./configure --enable-loadable-sqlite-extensions
    wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz
    tar -xvf Python-${PYTHON_VERSION}.tgz
    pushd Python-${PYTHON_VERSION}
    # Hats off to Yebolin https://github.com/pyenv/pyenv/issues/2416#issuecomment-1207579730
    # openssl11-devel is in epel
    CFLAGS="$CFLAGS $(pkg-config --cflags openssl11)" \
    LDFLAGS="$LDFLAGS $(pkg-config --libs openssl11)" \
    ./configure --enable-loadable-sqlite-extensions
    make -j$(nproc)
    sudo make altinstall
    make altinstall
    popd
    ```

    Testing

    ```bash
    #!/bin/bash

    yum install -y gcc-c++

    pushd /usr/share/i18n/charmaps
    for charmap_file in $(ls *.gz); do
    gzip -d $charmap_file
    done
    popd

    pushd Lib/test
    TESTED_LOCALES=$(../../python -c 'import test__locale; print(" ".join(test__locale.candidate_locales))')
    popd

    # Building Locales for testing
    for locale_id in $TESTED_LOCALES; do
    locale=$(echo $locale_id | sed 's/\..*//')
    charmap=$(echo $locale_id | grep '\.' | sed 's/^.*\.//' | sed 's/@.*//')
    variant=$(echo $locale_id | grep '@' | sed 's/.*@//')
    charmap=${charmap:-UTF-8}

    if echo $charmap | grep -E '^euc[A-Z]+$' &>/dev/null ; then
    charmap=$(echo $charmap | sed -E 's/euc([A-Z]+)/EUC-\1/')
    fi

    if echo $charmap | grep -E 'ISO[0-9]+.*' &>/dev/null ; then
    charmap=$(echo $charmap | sed 's/^ISO/ISO-/')
    fi

    echo "Building locale $locale_id"
    if ! [ -z "$variant" ]; then
    localedef -f ${charmap} -i ${locale}@${variant} $locale_id
    else
    localedef -f ${charmap} -i $locale $locale_id
    fi
    done

    make test
    ```

    ```
    == Tests result: FAILURE then SUCCESS ==
    415 tests OK.
    19 tests skipped:
    test_devpoll test_gdb test_idle test_ioctl test_kqueue
    test_launcher test_msilib test_ossaudiodev test_startfile test_tcl
    test_tix test_tk test_ttk_guionly test_ttk_textonly test_turtle
    test_winconsoleio test_winreg test_winsound test_zipfile64
    1 re-run test:
    test_nntplib
    Total duration: 4 min 6 sec
    Tests result: FAILURE then SUCCESS
    ```

    * `test_gdb` will be ignored as test script detects CentOS 7 official `gdb` package is
    compiled with Python 2.

    ## Alma Linux 8

    ~~The script should work in RHEL8 based systems.~~
  26. jacky9813 revised this gist Sep 14, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion building-python3.11.md
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@ The dependencies doesn't change much between these CPython versions, so Python 3
    may have the exact same process. (Obviously the link and the filename in the script must be
    changed.)

    All examples, unless explicitly set, uses `altinstall` target for installing Python onto
    All examples, unless `--prefix` is set, uses `altinstall` target for installing Python onto
    the system, which will install CPython into `/usr/local` by default and will not affect
    default `python` or `python3` command.

  27. jacky9813 revised this gist Sep 14, 2023. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions building-python3.11.md
    Original file line number Diff line number Diff line change
    @@ -11,6 +11,10 @@ The dependencies doesn't change much between these CPython versions, so Python 3
    may have the exact same process. (Obviously the link and the filename in the script must be
    changed.)

    All examples, unless explicitly set, uses `altinstall` target for installing Python onto
    the system, which will install CPython into `/usr/local` by default and will not affect
    default `python` or `python3` command.

    ## Operating Systems

    * [Debian 10+, Ubuntu 18.04+](#debian-10-ubuntu-1804)
  28. jacky9813 revised this gist Sep 14, 2023. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion building-python3.11.md
    Original file line number Diff line number Diff line change
    @@ -262,7 +262,6 @@ Tests result: FAILURE then SUCCESS

    * `test_gdb` will be ignored as test script detects openSUSE official `gdb` package is
    compiled with Python 2.
    * For some reason, `test_nntplib` never succeeds without re-run.

    ### TAR ball

  29. jacky9813 revised this gist Sep 14, 2023. 1 changed file with 39 additions and 8 deletions.
    47 changes: 39 additions & 8 deletions building-python3.11.md
    Original file line number Diff line number Diff line change
    @@ -23,20 +23,51 @@ changed.)

    ## Debian 10+, Ubuntu 18.04+

    Tested in [debian:buster](https://hub.docker.com/_/debian).

    * Note: For Ubuntu 18.04 with both packages `tk-dev` (8.6.0+9) and `tk8.6-dev` (8.6.8-4)
    installed, `_tkinter` module is refused to compile for unknown reason.

    ```bash
    sudo apt update
    sudo apt install -y libncurses-dev libbz2-dev libgdbm-dev liblzma-dev libssl-dev tk-dev \
    uuid-dev libreadline-dev libsqlite3-dev libffi-dev gcc make automake \
    wget libgdbm-dev libgdbm-compat-dev
    wget https://www.python.org/ftp/python/3.11.0/Python-3.11.0.tgz
    tar -xvf Python-3.11.0.tgz
    cd Python-3.11.0
    PYTHON_VERSION=3.11.5

    apt update
    apt install -y libncurses-dev libbz2-dev libgdbm-dev liblzma-dev libssl-dev tk-dev \
    uuid-dev libreadline-dev libsqlite3-dev libffi-dev gcc make automake \
    wget libgdbm-dev libgdbm-compat-dev
    wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz
    tar -xvf Python-${PYTHON_VERSION}.tgz
    cd Python-${PYTHON_VERSION}
    ./configure --enable-loadable-sqlite-extensions
    make -j$(nproc)
    sudo make altinstall
    make altinstall
    ```

    Testing

    ```bash
    #!/bin/bash
    apt install -y locales gdb g++
    sed -i -E 's/^\s*#\s+(\w+_\w+)/\1/g' /etc/locale.gen
    locale-gen
    make test
    ```

    ```
    == Tests result: FAILURE then SUCCESS ==
    420 tests OK.
    14 tests skipped:
    test_devpoll test_ioctl test_kqueue test_launcher test_msilib
    test_ossaudiodev test_startfile test_tix test_tk test_ttk_guionly
    test_winconsoleio test_winreg test_winsound test_zipfile64
    1 re-run test:
    test_nntplib
    Total duration: 5 min 32 sec
    Tests result: FAILURE then SUCCESS
    ```

    ## CentOS 7
  30. jacky9813 revised this gist Sep 14, 2023. 1 changed file with 39 additions and 8 deletions.
    47 changes: 39 additions & 8 deletions building-python3.11.md
    Original file line number Diff line number Diff line change
    @@ -17,7 +17,7 @@ changed.)
    * [CentOS 7](#centos-7)
    * [AlmaLinux 8](#almalinux-8)
    * [Rocky Linux 9](#rocky-linux-9)
    * [openSUSE 15.3](#opensuse-153)
    * [openSUSE Leap 15](#opensuse-leap-15)
    * [openSUSE Leap 42](#opensuse-leap-42)
    * [Alpine Linux 3.16.2](#alpine-linux-3162)

    @@ -120,18 +120,49 @@ make -j$(nproc)
    sudo make altinstall
    ```

    ## openSUSE 15.3
    ## openSUSE Leap 15

    Tested in [opensuse/leap:15.5](https://hub.docker.com/r/opensuse/leap).

    ```bash
    sudo zypper install -y ncurses-devel libbz2-devel gdbm-devel libnsl-devel xz-devel \
    PYTHON_VERSION=3.11.5

    zypper install -y ncurses-devel libbz2-devel gdbm-devel libnsl-devel xz-devel \
    libopenssl-3-devel tk-devel libuuid-devel readline-devel \
    sqlite3-devel libffi-devel gcc make automake wget tar gzip
    wget https://www.python.org/ftp/python/3.11.0/Python-3.11.0.tgz
    tar -xvf Python-3.11.0.tgz
    cd Python-3.11.0
    wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz
    tar -xvf Python-${PYTHON_VERSION}.tgz
    cd Python-${PYTHON_VERSION}
    ./configure --enable-loadable-sqlite-extensions
    make -j$(nproc)
    sudo make altinstall

    make altinstall
    ```

    Test

    ```bash
    #!/bin/bash
    # within compiled source directory
    zypper install -y gdb glibc-locale gcc-c++
    make test
    ```

    ```
    == Tests result: FAILURE then SUCCESS ==
    420 tests OK.
    14 tests skipped:
    test_devpoll test_ioctl test_kqueue test_launcher test_msilib
    test_ossaudiodev test_startfile test_tix test_tk test_ttk_guionly
    test_winconsoleio test_winreg test_winsound test_zipfile64
    3 re-run tests:
    test___all__ test_nntplib test_tools
    Total duration: 5 min 22 sec
    Tests result: FAILURE then SUCCESS
    ```

    ## openSUSE Leap 42
    @@ -175,7 +206,7 @@ Testing

    ```bash
    #!/bin/bash
    # with in compiled source directory
    # within compiled source directory
    zypper install -y glibc-locale gcc-c++
    make test
    ```