From 8ff660facdb624e1f9f9ec0a3deec1cef064028f Mon Sep 17 00:00:00 2001 From: Bensuperpc Date: Wed, 26 May 2021 20:02:47 +0200 Subject: [PATCH] Update to python 3.9.5, fix build fail with manylinuximage Update to python 3.9.5, fix build fail with manylinuximage Signed-off-by: Bensuperpc --- .github/workflows/main.yml | 2 +- common.debian | 22 ++++++++++++-- common.manylinux | 1 + imagefiles/build-and-install-python.sh | 40 ++++++++++++++++++++++++++ imagefiles/install-python-packages.sh | 4 +-- 5 files changed, 64 insertions(+), 5 deletions(-) create mode 100755 imagefiles/build-and-install-python.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f203025..3590cfe 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,7 +3,7 @@ name: Dockcross CI on: push: branches: - - 'master' + - '*' pull_request: branches: - '*' diff --git a/common.debian b/common.debian index 95c5309..beec2df 100644 --- a/common.debian +++ b/common.debian @@ -30,8 +30,8 @@ RUN \ ncurses-dev \ pkg-config \ pax \ - python \ - python-pip \ +# python3 \ +# python3-pip \ rsync \ sed \ ssh \ @@ -41,5 +41,23 @@ RUN \ xz-utils \ zip \ zlib1g-dev \ +# python build + libncurses5-dev \ + libgdbm-dev \ + libnss3-dev \ + libssl-dev \ + libsqlite3-dev \ + libreadline-dev \ + libffi-dev \ + libbz2-dev\ && \ apt-get clean --yes + +# build and install python +COPY \ + imagefiles/build-and-install-python.sh \ + /buildscripts/ +RUN \ + set -x && \ + /buildscripts/build-and-install-python.sh && \ + rm -rf /buildscripts \ No newline at end of file diff --git a/common.manylinux b/common.manylinux index a9434ea..e703860 100644 --- a/common.manylinux +++ b/common.manylinux @@ -8,6 +8,7 @@ RUN \ yum -y install \ $([ "$DEFAULT_DOCKCROSS_IMAGE" = "dockcross/manylinux2014-x86" ] && echo "" || echo "epel-release") \ gpg \ + python3-devel \ zlib-devel \ gettext \ openssh-clients \ diff --git a/imagefiles/build-and-install-python.sh b/imagefiles/build-and-install-python.sh new file mode 100755 index 0000000..b51871d --- /dev/null +++ b/imagefiles/build-and-install-python.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +# +# Configure, build and install python +# +# Usage: +# +# build-and-install-python.sh [-version 3.9.5] + +PYTHON_VERSION=3.9.5 +while [ $# -gt 0 ]; do + case "$1" in + -version|-v) + PYTHON_VERSION=$2 + shift + ;;& + *) + echo "Usage: Usage: ${0##*/} [-version 3.9.5]" + exit 1 + ;; + esac + shift +done + +# Download +wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz +tar xvf Python-${PYTHON_VERSION}.tgz +# Configure, build and install +cd Python-${PYTHON_VERSION} +# Disable --enable-shared --enable-optimizations --prefix=/usr/local/python-${PYTHON_VERSION} +./configure --with-ensurepip=install +make -j$(nproc) +make install #altinstall + +ln -s /usr/local/bin/python3 /usr/local/bin/python +ln -s /usr/local/bin/pip3 /usr/local/bin/pip + +# Clean +cd .. +rm -rf Python-${PYTHON_VERSION} diff --git a/imagefiles/install-python-packages.sh b/imagefiles/install-python-packages.sh index 62b9378..088a4e7 100755 --- a/imagefiles/install-python-packages.sh +++ b/imagefiles/install-python-packages.sh @@ -22,8 +22,8 @@ cd /tmp # Todo: Need to update base image from Debian Stretch for the required Python # 3.6 or later -# curl -# -LO https://bootstrap.pypa.io/pip/get-pip.py -curl -# -LO https://bootstrap.pypa.io/pip/2.7/get-pip.py +curl -# -LO https://bootstrap.pypa.io/pip/get-pip.py +#curl -# -LO https://bootstrap.pypa.io/pip/2.7/get-pip.py ${PYTHON} get-pip.py --ignore-installed rm get-pip.py