From e3fdb65fe8de3687d7694e0d77f31e46446dd2c1 Mon Sep 17 00:00:00 2001 From: lgray Date: Wed, 10 Jan 2024 13:24:27 +0000 Subject: [PATCH 1/8] Adds github actions to build python 3.9 --- .../build-manylinux/python3.9/Dockerfile | 22 +++++++++++++++ .../python3.9/build-manylinux.yml | 7 +++++ .../python3.9/build_alembic.sh | 28 +++++++++++++++++++ .github/workflows/wheels.yml | 9 ++++++ 4 files changed, 66 insertions(+) create mode 100644 .github/actions/build-manylinux/python3.9/Dockerfile create mode 100644 .github/actions/build-manylinux/python3.9/build-manylinux.yml create mode 100644 .github/actions/build-manylinux/python3.9/build_alembic.sh diff --git a/.github/actions/build-manylinux/python3.9/Dockerfile b/.github/actions/build-manylinux/python3.9/Dockerfile new file mode 100644 index 00000000..fde04402 --- /dev/null +++ b/.github/actions/build-manylinux/python3.9/Dockerfile @@ -0,0 +1,22 @@ +FROM aswf/ci-usd:2021.6 + +# install auditwheel and dependency +RUN yum install -y patchelf +RUN pip install auditwheel + +# build imath dependency (although this comes with ci-usd so should be unnecessary) +RUN git clone --depth 1 --branch v3.0.4 https://github.com/AcademySoftwareFoundation/Imath.git /Imath +RUN mkdir /imathbuild +RUN cd /imathbuild +RUN cmake /Imath -DPYTHON=ON +RUN make +RUN make install + +# Setup dev environment +ENV PLAT manylinux_2_17_x86_64 + +# Copy build script and build +COPY build_alembic.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh + +ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/.github/actions/build-manylinux/python3.9/build-manylinux.yml b/.github/actions/build-manylinux/python3.9/build-manylinux.yml new file mode 100644 index 00000000..0a41c239 --- /dev/null +++ b/.github/actions/build-manylinux/python3.9/build-manylinux.yml @@ -0,0 +1,7 @@ +# action.yml +name: 'Python 3.9 Manylinux Wheel' +author: 'Stefan Jeske, Max Last' +description: 'Build manylinux wheels for a Python package' +runs: + using: 'docker' + image: 'Dockerfile' \ No newline at end of file diff --git a/.github/actions/build-manylinux/python3.9/build_alembic.sh b/.github/actions/build-manylinux/python3.9/build_alembic.sh new file mode 100644 index 00000000..189f3812 --- /dev/null +++ b/.github/actions/build-manylinux/python3.9/build_alembic.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# Debugging options +set -e -x + +# Build Alembic +cd /github/workspace/ # Default location of packages in docker action +python3.9 setup.py bdist_wheel +python3.9 -m pip show alembic + +# Bundle external shared libraries into the wheels +find . -type f -iname "*-linux*.whl" -execdir sh -c "auditwheel repair '{}' -w ./ --plat '${PLAT}' || { echo 'Repairing wheels failed.'; auditwheel show '{}'; exit 1; }" \; + +# Install our wheel +WHEEL=$(find . -type f -iname "*-manylinux*.whl") +echo "Successfully built wheel, running a test pip install: $WHEEL" +python3.9 -m pip install --force-reinstall "$WHEEL" + +python3.9 -m pip show alembic + +echo "$PYTHONPATH" + +# make sure python has access to the alembic libraries +export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python3.9/site-packages + +# Run tests before releasing build +cd ./python/PyAlembic/Tests +python3.9 -m unittest discover \ No newline at end of file diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index b0d112ba..79c2c387 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -20,4 +20,13 @@ jobs: - uses: actions/upload-artifact@v2 with: name: python3.7wheel + path: dist/*-manylinux*.whl + py39: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: ./.github/actions/build-manylinux/python3.9 + - uses: actions/upload-artifact@v2 + with: + name: python3.9wheel path: dist/*-manylinux*.whl \ No newline at end of file From 758ac4f617f19b956eddd5a1bbe95f943722f9f9 Mon Sep 17 00:00:00 2001 From: lgray Date: Wed, 10 Jan 2024 13:41:40 +0000 Subject: [PATCH 2/8] updated docker environment to use python3.9 --- .github/actions/build-manylinux/python3.9/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/build-manylinux/python3.9/Dockerfile b/.github/actions/build-manylinux/python3.9/Dockerfile index fde04402..1defdf98 100644 --- a/.github/actions/build-manylinux/python3.9/Dockerfile +++ b/.github/actions/build-manylinux/python3.9/Dockerfile @@ -1,4 +1,4 @@ -FROM aswf/ci-usd:2021.6 +FROM aswf/ci-usd:2022.4 # install auditwheel and dependency RUN yum install -y patchelf From 7e7eb840ee63fad3e55a6167729a47cf13f7ad4e Mon Sep 17 00:00:00 2001 From: lgray Date: Fri, 26 Jan 2024 14:42:09 +0000 Subject: [PATCH 3/8] modified pattern for finding .whl files --- .github/actions/build-manylinux/python2.7/build_alembic.sh | 2 +- .github/actions/build-manylinux/python3.7/build_alembic.sh | 2 +- .github/actions/build-manylinux/python3.9/build_alembic.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/build-manylinux/python2.7/build_alembic.sh b/.github/actions/build-manylinux/python2.7/build_alembic.sh index 510b749a..8e09978f 100644 --- a/.github/actions/build-manylinux/python2.7/build_alembic.sh +++ b/.github/actions/build-manylinux/python2.7/build_alembic.sh @@ -61,7 +61,7 @@ python2.7 setup.py bdist_wheel find . -type f -iname "*-linux*.whl" -execdir sh -c "auditwheel repair '{}' -w ./ --plat '${PLAT}' || { echo 'Repairing wheels failed.'; auditwheel show '{}'; exit 1; }" \; # Install our wheel -WHEEL=$(find . -type f -iname "*-manylinux*.whl") +WHEEL=$(find . -type f -iname "*-linux*.whl") echo "Successfully built wheel, running a test pip install: $WHEEL" python2.7 -m pip install "$WHEEL" diff --git a/.github/actions/build-manylinux/python3.7/build_alembic.sh b/.github/actions/build-manylinux/python3.7/build_alembic.sh index 3c372bac..1d89cea0 100644 --- a/.github/actions/build-manylinux/python3.7/build_alembic.sh +++ b/.github/actions/build-manylinux/python3.7/build_alembic.sh @@ -12,7 +12,7 @@ python3.7 -m pip show alembic find . -type f -iname "*-linux*.whl" -execdir sh -c "auditwheel repair '{}' -w ./ --plat '${PLAT}' || { echo 'Repairing wheels failed.'; auditwheel show '{}'; exit 1; }" \; # Install our wheel -WHEEL=$(find . -type f -iname "*-manylinux*.whl") +WHEEL=$(find . -type f -iname "*-linux*.whl") echo "Successfully built wheel, running a test pip install: $WHEEL" python3.7 -m pip install --force-reinstall "$WHEEL" diff --git a/.github/actions/build-manylinux/python3.9/build_alembic.sh b/.github/actions/build-manylinux/python3.9/build_alembic.sh index 189f3812..8c9bf9ea 100644 --- a/.github/actions/build-manylinux/python3.9/build_alembic.sh +++ b/.github/actions/build-manylinux/python3.9/build_alembic.sh @@ -12,7 +12,7 @@ python3.9 -m pip show alembic find . -type f -iname "*-linux*.whl" -execdir sh -c "auditwheel repair '{}' -w ./ --plat '${PLAT}' || { echo 'Repairing wheels failed.'; auditwheel show '{}'; exit 1; }" \; # Install our wheel -WHEEL=$(find . -type f -iname "*-manylinux*.whl") +WHEEL=$(find . -type f -iname "*-linux*.whl") echo "Successfully built wheel, running a test pip install: $WHEEL" python3.9 -m pip install --force-reinstall "$WHEEL" From 545806290b281b5314c688e9fc448fce308419e1 Mon Sep 17 00:00:00 2001 From: lgray Date: Fri, 26 Jan 2024 16:30:30 +0000 Subject: [PATCH 4/8] avoid raising an error when dependencies are not found --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index e05ba205..7b91ff3f 100644 --- a/setup.py +++ b/setup.py @@ -79,7 +79,7 @@ def build_extension(self, ext): if missing_packages: error = "Unable to find packages: %s" % missing_packages - raise Exception(error) + # raise Exception(error) # build cmake_args = ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir, From 6271282984346aa6e204736afe76e0209ae04aa4 Mon Sep 17 00:00:00 2001 From: lgray Date: Fri, 26 Jan 2024 16:50:38 +0000 Subject: [PATCH 5/8] Fix for "ERROR: cannot verify downloads.sourceforge.net's certificate" --- .github/actions/build-manylinux/python2.7/build_alembic.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/build-manylinux/python2.7/build_alembic.sh b/.github/actions/build-manylinux/python2.7/build_alembic.sh index 8e09978f..8734a941 100644 --- a/.github/actions/build-manylinux/python2.7/build_alembic.sh +++ b/.github/actions/build-manylinux/python2.7/build_alembic.sh @@ -12,7 +12,7 @@ cd /home/ # Download and build dependencies of alembic # Download, build and install python -wget https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tgz +wget --no-check-certificate https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tgz tar -xzf Python-2.7.18.tgz cd Python-2.7.18 ./configure --enable-optimizations --enable-shared --enable-unicode=ucs4 From 4224c78de5e05c1d327f1334a6c2018e1a85b3a5 Mon Sep 17 00:00:00 2001 From: lgray Date: Fri, 26 Jan 2024 17:11:19 +0000 Subject: [PATCH 6/8] More wget --no-check-certificate fixes --- .../actions/build-manylinux/python2.7/build_alembic.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/actions/build-manylinux/python2.7/build_alembic.sh b/.github/actions/build-manylinux/python2.7/build_alembic.sh index 8734a941..dd1cbc14 100644 --- a/.github/actions/build-manylinux/python2.7/build_alembic.sh +++ b/.github/actions/build-manylinux/python2.7/build_alembic.sh @@ -23,7 +23,7 @@ python2.7 get-pip.py python2.7 -m pip install numpy # Boost 1.55 -wget https://sourceforge.net/projects/boost/files/boost/1.55.0/boost_1_55_0.tar.gz/download -O boost.tar.gz +wget --no-check-certificate https://sourceforge.net/projects/boost/files/boost/1.55.0/boost_1_55_0.tar.gz/download -O boost.tar.gz tar -xzf boost.tar.gz cd boost_1_55_0 ./bootstrap.sh --with-libraries=program_options,python --with-python=/usr/local/bin/python2.7 @@ -31,7 +31,7 @@ cd boost_1_55_0 cd .. && rm -rf boost_1_55_0 boost.tar.gz # Ilmbase -wget http://download.savannah.gnu.org/releases/openexr/ilmbase-2.2.0.tar.gz +wget --no-check-certificate http://download.savannah.gnu.org/releases/openexr/ilmbase-2.2.0.tar.gz tar -xzf ilmbase-2.2.0.tar.gz cd ilmbase-2.2.0 ./configure @@ -39,7 +39,7 @@ make install -j 4 cd .. && rm -rf ilmbase-2.2.0 ilmbase.2.2.0.tar.gz # PyIlmBase -wget http://download.savannah.gnu.org/releases/openexr/pyilmbase-2.2.0.tar.gz +wget --no-check-certificate http://download.savannah.gnu.org/releases/openexr/pyilmbase-2.2.0.tar.gz tar -xzf pyilmbase-2.2.0.tar.gz cd pyilmbase-2.2.0 PYTHON=/usr/local/bin/python2.7 ./configure @@ -47,7 +47,7 @@ make -j 4 && make install cd .. && rm -rf pyilmbase-2.2.0 pyilmbase.2.2.0.tar.gz # Build cmake 3.20 -wget https://github.com/Kitware/CMake/releases/download/v3.20.0/cmake-3.20.0.tar.gz +wget --no-check-certificate https://github.com/Kitware/CMake/releases/download/v3.20.0/cmake-3.20.0.tar.gz tar -xzf cmake-3.20.0.tar.gz cd cmake-3.20.0 ./bootstrap From 0093db397aff55439caf0be4a8fef1fc94389dd8 Mon Sep 17 00:00:00 2001 From: lgray Date: Fri, 26 Jan 2024 18:22:25 +0000 Subject: [PATCH 7/8] auditwheel repair requires patchelf >= 0.14 --- .github/actions/build-manylinux/python3.7/build_alembic.sh | 7 +++++++ .github/actions/build-manylinux/python3.9/build_alembic.sh | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/.github/actions/build-manylinux/python3.7/build_alembic.sh b/.github/actions/build-manylinux/python3.7/build_alembic.sh index 1d89cea0..a8f7ddf7 100644 --- a/.github/actions/build-manylinux/python3.7/build_alembic.sh +++ b/.github/actions/build-manylinux/python3.7/build_alembic.sh @@ -8,6 +8,13 @@ cd /github/workspace/ # Default location of packages in docker action python3.7 setup.py bdist_wheel python3.7 -m pip show alembic +# Patchelf 0.14.5 +wget --no-check-certificate https://github.com/NixOS/patchelf/releases/download/0.14.5/patchelf-0.14.5.tar.gz +tar -xzf patchelf-0.14.5.tar.gz +cd patchelf-0.14.5 +./configure +make -j 4 && make install + # Bundle external shared libraries into the wheels find . -type f -iname "*-linux*.whl" -execdir sh -c "auditwheel repair '{}' -w ./ --plat '${PLAT}' || { echo 'Repairing wheels failed.'; auditwheel show '{}'; exit 1; }" \; diff --git a/.github/actions/build-manylinux/python3.9/build_alembic.sh b/.github/actions/build-manylinux/python3.9/build_alembic.sh index 8c9bf9ea..4dfb7f96 100644 --- a/.github/actions/build-manylinux/python3.9/build_alembic.sh +++ b/.github/actions/build-manylinux/python3.9/build_alembic.sh @@ -8,6 +8,13 @@ cd /github/workspace/ # Default location of packages in docker action python3.9 setup.py bdist_wheel python3.9 -m pip show alembic +# Patchelf 0.14.5 +wget --no-check-certificate https://github.com/NixOS/patchelf/releases/download/0.14.5/patchelf-0.14.5.tar.gz +tar -xzf patchelf-0.14.5.tar.gz +cd patchelf-0.14.5 +./configure +make -j 4 && make install + # Bundle external shared libraries into the wheels find . -type f -iname "*-linux*.whl" -execdir sh -c "auditwheel repair '{}' -w ./ --plat '${PLAT}' || { echo 'Repairing wheels failed.'; auditwheel show '{}'; exit 1; }" \; From 9acff2cd4c8beaf9792d64fa4e47e9e213231a64 Mon Sep 17 00:00:00 2001 From: lgray Date: Fri, 26 Jan 2024 18:52:19 +0000 Subject: [PATCH 8/8] return to default location after installing patchelf --- .github/actions/build-manylinux/python3.7/build_alembic.sh | 3 +++ .github/actions/build-manylinux/python3.9/build_alembic.sh | 3 +++ 2 files changed, 6 insertions(+) diff --git a/.github/actions/build-manylinux/python3.7/build_alembic.sh b/.github/actions/build-manylinux/python3.7/build_alembic.sh index a8f7ddf7..5a31fc23 100644 --- a/.github/actions/build-manylinux/python3.7/build_alembic.sh +++ b/.github/actions/build-manylinux/python3.7/build_alembic.sh @@ -15,6 +15,9 @@ cd patchelf-0.14.5 ./configure make -j 4 && make install +# Return to default location docker action +cd /github/workspace/ + # Bundle external shared libraries into the wheels find . -type f -iname "*-linux*.whl" -execdir sh -c "auditwheel repair '{}' -w ./ --plat '${PLAT}' || { echo 'Repairing wheels failed.'; auditwheel show '{}'; exit 1; }" \; diff --git a/.github/actions/build-manylinux/python3.9/build_alembic.sh b/.github/actions/build-manylinux/python3.9/build_alembic.sh index 4dfb7f96..64b4c190 100644 --- a/.github/actions/build-manylinux/python3.9/build_alembic.sh +++ b/.github/actions/build-manylinux/python3.9/build_alembic.sh @@ -15,6 +15,9 @@ cd patchelf-0.14.5 ./configure make -j 4 && make install +# Return to default location docker action +cd /github/workspace/ + # Bundle external shared libraries into the wheels find . -type f -iname "*-linux*.whl" -execdir sh -c "auditwheel repair '{}' -w ./ --plat '${PLAT}' || { echo 'Repairing wheels failed.'; auditwheel show '{}'; exit 1; }" \;