Skip to content

Fix build for Python 3.12 #238

Fix build for Python 3.12

Fix build for Python 3.12 #238

Workflow file for this run

name: setuptools-dso
on: [push, pull_request, workflow_dispatch]
defaults:
run:
shell: bash
jobs:
test:
runs-on: ${{ matrix.os }}
name: Test ${{ matrix.python-version }} / ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
python-version: ["3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.x"]
exclude:
# missing Microsoft Visual C++ 14.0
- os: windows-latest
python-version: "3.5"
# GHA doesn't list 3.5, or 3.6 for ubuntu-22.04
- os: ubuntu-latest
python-version: "3.5"
- os: ubuntu-latest
python-version: "3.6"
include:
# has Microsoft Visual C++ 14.0
- os: windows-2019
python-version: "3.5"
# GHA doesn't list 3.5, or 3.6 for ubuntu-22
- os: ubuntu-20.04
python-version: "3.5"
- os: ubuntu-20.04
python-version: "3.6"
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Prepare
run: |
set -x
which python
python --version
python -m pip install -U pip
python -m pip --version
- name: Deps
shell: bash
run: |
set -x
pip download -d dist setuptools wheel nose2 cython
python -m pip install -v --no-index -f dist setuptools wheel nose2 cython
python -m nose2 -h
- name: Build/Install
shell: bash
run: |
set -x
python setup.py sdist --formats=gztar
ls dist
# build from source tar to ensure completeness
python -m pip install -v --no-index -f dist setuptools_dso
- name: Test
shell: bash
run: |
set -x
python -m setuptools_dso.probe
python -m nose2 setuptools_dso
- name: Test Example wheel
shell: bash
run: |
set -x
ls dist
cd example
python setup.py clean -a
git clean -fdx .
python -m pip install -v --no-index -f ../dist .
cd project2
# install project2.
# --no-build-isolation is needed so that ^^^ installed dsodemo could be found.
# --no-use-pep517 is used to workaround https://github.com/pypa/setuptools/issues/1694 on py36 and py35
python -m pip install -v --no-index -f ../dist wheel # needed by vvv
python -m pip install -v --no-index --no-build-isolation --no-use-pep517 -f ../../dist .
cd ../..
python -m dsodemo.cli
python -m nose2 dsodemo
python -m use_dsodemo.cli
- name: Test Example inplace
shell: bash
run: |
set -x
cd example
python setup.py clean -a
git clean -fdx .
export PYTHONPATH="`pwd`/src"
python setup.py -v build_dso -i
python setup.py -v build_dso -i -f # incremental recompile
python setup.py -v build_ext -i
cd project2
python setup.py -v build_ext -i
cd ../..
python -m dsodemo.cli
(cd example/project2/src && python -m use_dsodemo.cli)
- name: Test Example DSO only
shell: bash
run: |
set -x
cd example
python setup.py clean -a
git clean -fdx .
rm -f dist/*.whl
python setup-dso-only.py -v bdist_wheel
python -m wheel unpack -d junk dist/*.whl
find junk
ls junk/*/*.dist-info/WHEEL
! ls junk/*/*/purelib
- name: Test Namespace Packages with conventional install
shell: bash
run: |
set -x
cd example/namespaces
cd package-core && python setup.py clean -a && cd ..
cd package-dso && python setup.py clean -a && cd ..
git clean -fdx .
rm -rf */dist */build */*.egg-info
cd package-core && python -m pip install -v --no-build-isolation --no-index . && cd ..
cd package-dso && python -m pip install -v --no-build-isolation --no-index . && cd ..
cd ../..
python -c "import testnsp.testcore"
python -c "import testnsp.testdso"
python -c "import testnsp.testdso.thepyd"
- name: Test Namespace Packages with editable install
shell: bash
run: |
set -x
cd example/namespaces
cd package-core && python setup.py clean -a && cd ..
cd package-dso && python setup.py clean -a && cd ..
git clean -fdx .
rm -rf */dist */build */*.egg-info
cd package-core && python -m pip install -v --no-build-isolation --no-index -e . && cd ..
cd package-dso && python -m pip install -v --no-build-isolation --no-index -e . && cd ..
cd ../..
python -c "import testnsp.testcore"
python -c "import testnsp.testdso"
python -c "import testnsp.testdso.thepyd"
manylinux:
runs-on: ubuntu-latest
name: Test ${{ matrix.pyver }} / ${{ matrix.manylinux }}_${{ matrix.piparch }}
strategy:
fail-fast: false
matrix:
manylinux: ["manylinux1", "manylinux2010", "manylinux2014"]
piparch: ["i686", "x86_64"]
pyver: ["cp27-cp27m", "cp27-cp27mu", "cp36-cp36m", "cp37-cp37m", "cp38-cp38", "cp39-cp39", "cp310-cp310", "cp311-cp311", "cp312-cp312"]
exclude:
# manylinux1 doesn't include py >= 3.10
- manylinux: "manylinux1"
piparch: "i686"
pyver: "cp310-cp310"
- manylinux: "manylinux1"
piparch: "x86_64"
pyver: "cp310-cp310"
- manylinux: "manylinux1"
piparch: "i686"
pyver: "cp311-cp311"
- manylinux: "manylinux1"
piparch: "x86_64"
pyver: "cp311-cp311"
- manylinux: "manylinux1"
piparch: "i686"
pyver: "cp312-cp312"
- manylinux: "manylinux1"
piparch: "x86_64"
pyver: "cp312-cp312"
# manylinux2010 and above don't provide 2.7 in images
- manylinux: "manylinux2010"
piparch: "i686"
pyver: "cp27-cp27m"
- manylinux: "manylinux2010"
piparch: "i686"
pyver: "cp27-cp27mu"
- manylinux: "manylinux2010"
piparch: "x86_64"
pyver: "cp27-cp27m"
- manylinux: "manylinux2010"
piparch: "x86_64"
pyver: "cp27-cp27mu"
- manylinux: "manylinux2014"
piparch: "i686"
pyver: "cp27-cp27m"
- manylinux: "manylinux2014"
piparch: "i686"
pyver: "cp27-cp27mu"
- manylinux: "manylinux2014"
piparch: "x86_64"
pyver: "cp27-cp27m"
- manylinux: "manylinux2014"
piparch: "x86_64"
pyver: "cp27-cp27mu"
# manylinux2010 doesn't include pip with >= 3.11
- manylinux: "manylinux2010"
piparch: "i686"
pyver: "cp311-cp311"
- manylinux: "manylinux2010"
piparch: "x86_64"
pyver: "cp311-cp311"
- manylinux: "manylinux2010"
piparch: "i686"
pyver: "cp312-cp312"
- manylinux: "manylinux2010"
piparch: "x86_64"
pyver: "cp312-cp312"
steps:
- uses: actions/checkout@v3
- name: Test
run: |
# can't use GHA native docker support since GHA magic binaries need .so absent from old manylinux images :(
cat <<EOF > runit.sh
#!/bin/sh
set -e -x
ls /opt/python/*/bin/python
cd /io
export PATH="/opt/python/${{ matrix.pyver }}/bin:\$PATH"
which python
python -m pip download -d dist setuptools wheel nose2
python -m pip install -v --no-index -f dist setuptools wheel nose2
python setup.py sdist --formats=gztar
python -m pip wheel -v --no-index -w dist -f dist setuptools_dso
export SETUPTOOLS_DSO_PLAT_NAME="${{ matrix.manylinux }}_${{ matrix.piparch }}"
python -m pip install -v --no-index -f dist setuptools_dso
python -m setuptools_dso.probe
python -m nose2 setuptools_dso
cd example
python setup.py sdist -d ../dist --formats=gztar
cd ..
ls dist
python -m pip install -f dist --no-index dsodemo
cd dist
python -m dsodemo.cli
python -m nose2 dsodemo
EOF
cat runit.sh
chmod +x runit.sh
docker pull quay.io/pypa/${{ matrix.manylinux }}_${{ matrix.piparch }}
docker run --rm -v `pwd`:/io quay.io/pypa/${{ matrix.manylinux }}_${{ matrix.piparch }} ${{ matrix.pre }} /io/runit.sh
upload:
runs-on: ubuntu-latest
needs: [test, manylinux]
name: Upload
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: "3.7"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
twine -h
- name: setup.py sdist
shell: bash
run: |
echo "Event: ${{ github.event_name }}"
echo "Ref: ${{ github.ref }}"
set -x
python -m pip install -U pip
python -m pip install setuptools wheel
python setup.py sdist
python -m pip wheel -w dist dist/setuptools_dso-*.tar.*
ls dist/setuptools_dso-*
tar -taf dist/setuptools_dso-*.tar.*
- name: Save
uses: actions/upload-artifact@v3
with:
name: artifacts
path: dist/setuptools_dso-*
- name: Upload
if: startsWith(github.ref, 'refs/tags/')
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload dist/setuptools_dso-*