From 5cd01fff84ff2ade537fbce3ccae55ddec9c580e Mon Sep 17 00:00:00 2001 From: Mizux Seiha Date: Mon, 20 Apr 2020 23:11:16 +0200 Subject: [PATCH] tools(docker): Fix python package * Update build_manylinux1.sh * Force auditwheel to 2.0.0 note: last version 3.1.0 reset rpath to a broken one... --- tools/docker/Makefile | 1 + tools/docker/build-manylinux1.sh | 17 ++++++++++++++--- tools/docker/manylinux1.Dockerfile | 27 ++++++++++++++------------- 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/tools/docker/Makefile b/tools/docker/Makefile index 119d8f2697..9d62ed7bdd 100644 --- a/tools/docker/Makefile +++ b/tools/docker/Makefile @@ -121,6 +121,7 @@ docker_python: manylinux1.Dockerfile export/python/build-manylinux1.sh ../../mak --tag $(IMAGE):python \ --build-arg SRC_GIT_BRANCH=$(OR_TOOLS_BRANCH) \ --build-arg SRC_GIT_SHA1=$(OR_TOOLS_SHA1) \ + --target=build \ -f $< \ export/python diff --git a/tools/docker/build-manylinux1.sh b/tools/docker/build-manylinux1.sh index 998eaacdce..4b3409557f 100755 --- a/tools/docker/build-manylinux1.sh +++ b/tools/docker/build-manylinux1.sh @@ -61,11 +61,19 @@ function export_manylinux_wheel { make clean_python make python #make test_python - make pypi_archive + make package_python + #make test_package_python # Build and repair wheels cd temp_python*/ortools/dist - auditwheel repair --plat manylinux2010_x86_64 ./*.whl -w "$export_root" -} + for FILE in *.whl; do + # if no files found do nothing + [[ -e "$FILE" ]] || continue + cp "$FILE" "${export_root}/${FILE%.whl}"_unfixed.whl + auditwheel show "$FILE" + /opt/_internal/cpython-3.7.7/bin/python -m auditwheel -v repair --plat manylinux2010_x86_64 "$FILE" -w "$export_root" + #auditwheel -v repair --plat manylinux2010_x86_64 "$FILE" -w "$export_root" + done + } function test_installed { # Run all the specified test scripts using the current environment. @@ -137,6 +145,9 @@ TESTS=( # cf pypa/auditwheel#102 #/opt/_internal/cpython-3.6.6/bin/python -m pip install wheel==0.31.1 +# Downgrade auditwheel +/opt/_internal/cpython-3.7.7/bin/pip install auditwheel==2.0.0 + mkdir -p "${BUILD_ROOT}" mkdir -p "${EXPORT_ROOT}" diff --git a/tools/docker/manylinux1.Dockerfile b/tools/docker/manylinux1.Dockerfile index 852ef74d94..6e2c6415d5 100644 --- a/tools/docker/manylinux1.Dockerfile +++ b/tools/docker/manylinux1.Dockerfile @@ -1,4 +1,4 @@ -FROM quay.io/pypa/manylinux2010_x86_64:latest +FROM quay.io/pypa/manylinux2010_x86_64:latest AS env RUN yum -y update \ && yum -y install \ @@ -39,16 +39,22 @@ RUN curl --location-trusted \ && cd .. \ && rm -rf swig-4.0.1 -# Update auditwheel to support manylinux2010 -#RUN /opt/_internal/cpython-3.7.6/bin/pip install auditwheel==2.0.0 - ENV TZ=America/Los_Angeles RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone +ENV BUILD_ROOT /root/build +ENV EXPORT_ROOT /export +# The build of Python 2.6.x bindings is known to be broken. +# Python3.4 include conflict with abseil-cpp dynamic_annotation.h +ENV SKIP_PLATFORMS "cp27-cp27m cp27-cp27mu cp34-cp34m" + +COPY build-manylinux1.sh "$BUILD_ROOT/" +RUN chmod a+x "${BUILD_ROOT}/build-manylinux1.sh" + ################ ## OR-TOOLS ## ################ -ENV BUILD_ROOT /root/build +FROM env AS devel ENV SRC_GIT_URL https://github.com/google/or-tools ENV SRC_ROOT /root/src WORKDIR "$BUILD_ROOT" @@ -59,14 +65,9 @@ ARG SRC_GIT_SHA1 ENV SRC_GIT_SHA1 ${SRC_GIT_SHA1:-unknown} RUN git clone -b "$SRC_GIT_BRANCH" --single-branch "$SRC_GIT_URL" "$SRC_ROOT" +FROM devel AS third_party WORKDIR "$SRC_ROOT" RUN make third_party + +FROM third_party as build RUN make cc - -ENV EXPORT_ROOT /export -# The build of Python 2.6.x bindings is known to be broken. -# Python3.4 include conflict with abseil-cpp dynamic_annotation.h -ENV SKIP_PLATFORMS "cp27-cp27m cp27-cp27mu cp34-cp34m" - -COPY build-manylinux1.sh "$BUILD_ROOT" -RUN chmod ugo+x "${BUILD_ROOT}/build-manylinux1.sh"