mirror of
https://github.com/biojppm/rapidyaml.git
synced 2026-01-18 21:41:18 +01:00
Fix python wheel build and workflows
This commit is contained in:
137
.github/workflows-in/api.ys
vendored
Normal file
137
.github/workflows-in/api.ys
vendored
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
!yamlscript/v0
|
||||||
|
|
||||||
|
python-preamble-job =::
|
||||||
|
runs-on: ${{matrix.config.os}}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
config:
|
||||||
|
- {pythonv: '3.13', os: ubuntu-latest}
|
||||||
|
- {pythonv: '3.13', os: macos-13}
|
||||||
|
python-preamble-job-win =::
|
||||||
|
runs-on: ${{matrix.config.os}}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
config:
|
||||||
|
- {pythonv: '3.13', os: windows-latest}
|
||||||
|
|
||||||
|
|
||||||
|
setup-env-win =::
|
||||||
|
- name: setup env (Visual Studio)
|
||||||
|
uses: TheMrMilchmann/setup-msvc-dev@v3
|
||||||
|
with:
|
||||||
|
arch: ${{matrix.config.vsenvarch}}
|
||||||
|
|
||||||
|
|
||||||
|
python-preamble-steps =::
|
||||||
|
- name: install python ${{matrix.config.pythonv}}
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: ${{matrix.config.pythonv}}
|
||||||
|
- name: deps
|
||||||
|
run: |
|
||||||
|
if [[ "${{matrix.config.os}}" == macos* ]] ; then
|
||||||
|
brew install swig
|
||||||
|
elif [[ "${{matrix.config.os}}" == windows* ]] ; then
|
||||||
|
choco install swig
|
||||||
|
fi
|
||||||
|
pip install build deprecation pytest
|
||||||
|
pip install -r requirements.txt
|
||||||
|
|
||||||
|
|
||||||
|
defn python-wheel-steps(name create-wheel-cmd)::
|
||||||
|
- name:: "------------------- $name"
|
||||||
|
run: rm -rf build/ dist/
|
||||||
|
- name:: "create wheel with $create-wheel-cmd"
|
||||||
|
run:: |
|
||||||
|
$create-wheel-cmd
|
||||||
|
- name: install wheel
|
||||||
|
run: pip install dist/*.whl
|
||||||
|
- name: test with pytest
|
||||||
|
run: python -m pytest -vvv api/python/tests
|
||||||
|
|
||||||
|
|
||||||
|
python-wheel-tests =::
|
||||||
|
- :: python-wheel-steps('using setup.py' 'python setup.py bdist_wheel -v')
|
||||||
|
- :: python-wheel-steps('using pip' 'pip wheel -w dist/ .')
|
||||||
|
- :: python-wheel-steps('using pypa/build' 'python -m build --wheel')
|
||||||
|
|
||||||
|
|
||||||
|
python-bare-tests =::
|
||||||
|
- name: configure
|
||||||
|
run: |
|
||||||
|
cmake -B build/py \
|
||||||
|
-D CMAKE_BUILD_TYPE=Release \
|
||||||
|
-D BUILD_SHARED_LIBS=ON \
|
||||||
|
-D RYML_DEFAULT_CALLBACK_USES_EXCEPTIONS=ON \
|
||||||
|
-D RYML_BUILD_API=ON \
|
||||||
|
-D RYML_API_TESTS=ON \
|
||||||
|
-D RYML_BUILD_TESTS=ON
|
||||||
|
- name: build
|
||||||
|
run: |
|
||||||
|
cmake --build build/py -j -v --target ryml-api-python3
|
||||||
|
cp -fv api/python/ryml/__init__.py build/py/api/python3/.
|
||||||
|
ls -lFpAR build/py/api/python3/*
|
||||||
|
- name: test with ctest
|
||||||
|
run: |
|
||||||
|
export PYTHONPATH=`pwd`/build/py/api/python3:$PYTHONPATH
|
||||||
|
cmake --build build/py -j -v --target ryml-api-test-python3
|
||||||
|
- name: test with pytest
|
||||||
|
run: |
|
||||||
|
export PYTHONPATH=`pwd`/build/py/api/python3:$PYTHONPATH
|
||||||
|
python -m pytest -vvv api/python/tests
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
!yamlscript/v0:
|
||||||
|
|
||||||
|
:use common: :all
|
||||||
|
:: workflow-setup()
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
#----------------------------------------------------
|
||||||
|
# verify that we can explicitly run the python API
|
||||||
|
# without creating or installing a wheel
|
||||||
|
pybare:
|
||||||
|
:: setup-job('api' 'pybare')
|
||||||
|
name: pybare/${{matrix.config.pythonv}}/${{matrix.config.os}}
|
||||||
|
:: python-preamble-job
|
||||||
|
steps:
|
||||||
|
- :: checkout-action
|
||||||
|
- :: python-preamble-steps
|
||||||
|
- :: python-bare-tests
|
||||||
|
pybarewin:
|
||||||
|
:: setup-job('api' 'pybarewin')
|
||||||
|
name: pybare/${{matrix.config.pythonv}}/${{matrix.config.os}}
|
||||||
|
:: python-preamble-job-win
|
||||||
|
steps:
|
||||||
|
- :: checkout-action
|
||||||
|
- :: python-preamble-steps
|
||||||
|
- :: setup-env-win
|
||||||
|
- :: python-bare-tests
|
||||||
|
|
||||||
|
#----------------------------------------------------
|
||||||
|
# run tests with built+installed wheels
|
||||||
|
pywheel:
|
||||||
|
:: setup-job('api' 'pywheel')
|
||||||
|
name: pywheel/${{matrix.config.pythonv}}/${{matrix.config.os}}
|
||||||
|
:: python-preamble-job
|
||||||
|
env:
|
||||||
|
CMAKE_FLAGS: -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILES=ON
|
||||||
|
steps:
|
||||||
|
- :: checkout-action
|
||||||
|
- :: python-preamble-steps
|
||||||
|
- :: python-wheel-tests
|
||||||
|
pywheelwin:
|
||||||
|
:: setup-job('api' 'pywheel_win')
|
||||||
|
name: pywheel/${{matrix.config.pythonv}}/${{matrix.config.os}}
|
||||||
|
:: python-preamble-job-win
|
||||||
|
env:
|
||||||
|
CMAKE_FLAGS: -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILES=ON
|
||||||
|
steps:
|
||||||
|
- :: checkout-action
|
||||||
|
- :: python-preamble-steps
|
||||||
|
- :: setup-env-win
|
||||||
|
- :: python-wheel-tests
|
||||||
274
.github/workflows-in/release.ys
vendored
274
.github/workflows-in/release.ys
vendored
@@ -1,3 +1,93 @@
|
|||||||
|
!yamlscript/v0
|
||||||
|
|
||||||
|
|
||||||
|
defn pywhl(pyv cibwpyv cibwarch cibwplatform os vsenvarch='' cmkflags=''):: # NOTE: cannot use _ in names?
|
||||||
|
name:: "python/$pyv/$cibwplatform"
|
||||||
|
sfx:: "python$pyv-$cibwplatform" # suffix
|
||||||
|
os:: os
|
||||||
|
pythonv:: pyv
|
||||||
|
cibw_pyv:: cibwpyv #pyv.replace(/\.//) # WTF??
|
||||||
|
cibw_arch:: cibwarch
|
||||||
|
cibw_platform:: cibwplatform
|
||||||
|
#cmakeflags:: cmkflags
|
||||||
|
vsenvarch:: vsenvarch
|
||||||
|
|
||||||
|
|
||||||
|
python-wheel-matrix =::
|
||||||
|
# pyv arch platform os
|
||||||
|
- ! pywhl('3.13' 313 'x86_64' 'manylinux_x86_64' 'ubuntu-24.04')
|
||||||
|
- ! pywhl('3.13' 313 'i686' 'manylinux_i686' 'ubuntu-24.04')
|
||||||
|
- ! pywhl('3.13' 313 'x86_64' 'macosx_x86_64' 'macos-13' )
|
||||||
|
#
|
||||||
|
- ! pywhl('3.12' 312 'x86_64' 'manylinux_x86_64' 'ubuntu-24.04')
|
||||||
|
- ! pywhl('3.12' 312 'i686' 'manylinux_i686' 'ubuntu-24.04')
|
||||||
|
- ! pywhl('3.12' 312 'x86_64' 'macosx_x86_64' 'macos-13' )
|
||||||
|
#
|
||||||
|
- ! pywhl('3.11' 311 'x86_64' 'manylinux_x86_64' 'ubuntu-24.04')
|
||||||
|
- ! pywhl('3.11' 311 'i686' 'manylinux_i686' 'ubuntu-24.04')
|
||||||
|
- ! pywhl('3.11' 311 'x86_64' 'macosx_x86_64' 'macos-13' )
|
||||||
|
#
|
||||||
|
- ! pywhl('3.10' 310 'x86_64' 'manylinux_x86_64' 'ubuntu-24.04')
|
||||||
|
- ! pywhl('3.10' 310 'i686' 'manylinux_i686' 'ubuntu-24.04')
|
||||||
|
- ! pywhl('3.10' 310 'x86_64' 'macosx_x86_64' 'macos-13' )
|
||||||
|
#
|
||||||
|
- ! pywhl('3.9' 39 'x86_64' 'manylinux_x86_64' 'ubuntu-24.04')
|
||||||
|
- ! pywhl('3.9' 39 'i686' 'manylinux_i686' 'ubuntu-24.04')
|
||||||
|
- ! pywhl('3.9' 39 'x86_64' 'macosx_x86_64' 'macos-13' )
|
||||||
|
#
|
||||||
|
- ! pywhl('3.8' 38 'x86_64' 'manylinux_x86_64' 'ubuntu-24.04')
|
||||||
|
- ! pywhl('3.8' 38 'i686' 'manylinux_i686' 'ubuntu-24.04')
|
||||||
|
- ! pywhl('3.8' 38 'x86_64' 'macosx_x86_64' 'macos-13' )
|
||||||
|
#
|
||||||
|
- ! pywhl('3.7' 37 'x86_64' 'manylinux_x86_64' 'ubuntu-22.04')
|
||||||
|
- ! pywhl('3.7' 37 'i686' 'manylinux_i686' 'ubuntu-22.04')
|
||||||
|
- ! pywhl('3.7' 37 'x86_64' 'macosx_x86_64' 'macos-13' )
|
||||||
|
#
|
||||||
|
- ! pywhl('3.6' 36 'x86_64' 'manylinux_x86_64' 'ubuntu-20.04') # setup-python 3.6 requires ubuntu 20.04
|
||||||
|
- ! pywhl('3.6' 36 'i686' 'manylinux_i686' 'ubuntu-20.04') # setup-python 3.6 requires ubuntu 20.04
|
||||||
|
- ! pywhl('3.6' 36 'x86_64' 'macosx_x86_64' 'macos-13' )
|
||||||
|
|
||||||
|
|
||||||
|
python-wheel-matrix-win =::
|
||||||
|
# pyv arch platform os vsenvarch cmakeflags
|
||||||
|
- ! pywhl('3.13' 313 'AMD64' 'win_amd64' 'windows-2022' 'x64' '-G "Visual Studio 17 2022" -A x64')
|
||||||
|
- ! pywhl('3.13' 313 'x86' 'win32' 'windows-2022' 'x86' '-G "Visual Studio 17 2022" -A Win32')
|
||||||
|
#
|
||||||
|
- ! pywhl('3.12' 312 'AMD64' 'win_amd64' 'windows-2022' 'x64' '-G "Visual Studio 17 2022" -A x64')
|
||||||
|
- ! pywhl('3.12' 312 'x86' 'win32' 'windows-2022' 'x86' '-G "Visual Studio 17 2022" -A Win32')
|
||||||
|
#
|
||||||
|
- ! pywhl('3.11' 311 'AMD64' 'win_amd64' 'windows-2022' 'x64' '-G "Visual Studio 17 2022" -A x64')
|
||||||
|
- ! pywhl('3.11' 311 'x86' 'win32' 'windows-2022' 'x86' '-G "Visual Studio 17 2022" -A Win32')
|
||||||
|
#
|
||||||
|
- ! pywhl('3.10' 310 'AMD64' 'win_amd64' 'windows-2022' 'x64' '-G "Visual Studio 17 2022" -A x64')
|
||||||
|
- ! pywhl('3.10' 310 'x86' 'win32' 'windows-2022' 'x86' '-G "Visual Studio 17 2022" -A Win32')
|
||||||
|
#
|
||||||
|
- ! pywhl('3.9' 39 'AMD64' 'win_amd64' 'windows-2022' 'x64' '-G "Visual Studio 17 2022" -A x64')
|
||||||
|
- ! pywhl('3.9' 39 'x86' 'win32' 'windows-2022' 'x86' '-G "Visual Studio 17 2022" -A Win32')
|
||||||
|
#
|
||||||
|
- ! pywhl('3.8' 38 'AMD64' 'win_amd64' 'windows-2022' 'x64' '-G "Visual Studio 17 2022" -A x64')
|
||||||
|
- ! pywhl('3.8' 38 'x86' 'win32' 'windows-2022' 'x86' '-G "Visual Studio 17 2022" -A Win32')
|
||||||
|
#
|
||||||
|
- ! pywhl('3.7' 37 'AMD64' 'win_amd64' 'windows-2022' 'x64' '-G "Visual Studio 17 2022" -A x64')
|
||||||
|
#- ! pywhl('3.7' 37 'x86' 'win32' 'windows-2022' 'x86' '-G "Visual Studio 17 2022" -A Win32')
|
||||||
|
#
|
||||||
|
- ! pywhl('3.6' 36 'AMD64' 'win_amd64' 'windows-2022' 'x64' '-G "Visual Studio 17 2022" -A x64')
|
||||||
|
- ! pywhl('3.6' 36 'x86' 'win32' 'windows-2022' 'x86' '-G "Visual Studio 17 2022" -A Win32')
|
||||||
|
|
||||||
|
|
||||||
|
setup-env =::
|
||||||
|
- name: setup env (non-win)
|
||||||
|
run: echo 'nothing to do'
|
||||||
|
|
||||||
|
|
||||||
|
setup-env-win =::
|
||||||
|
- name: setup env (Visual Studio)
|
||||||
|
uses: TheMrMilchmann/setup-msvc-dev@v3
|
||||||
|
with:
|
||||||
|
arch: ${{matrix.config.vsenvarch}}
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
!yamlscript/v0:
|
!yamlscript/v0:
|
||||||
|
|
||||||
:use common: :all
|
:use common: :all
|
||||||
@@ -5,6 +95,72 @@
|
|||||||
push:
|
push:
|
||||||
tags: [v0.*, v1.*, v2.*]
|
tags: [v0.*, v1.*, v2.*]
|
||||||
branches: [master]
|
branches: [master]
|
||||||
|
::
|
||||||
|
defn define-workflow-python-wheels(name matrix setup-env)::
|
||||||
|
:: setup-job('release' name)
|
||||||
|
name: ${{matrix.config.name}}
|
||||||
|
runs-on: ${{matrix.config.os}}
|
||||||
|
env:
|
||||||
|
CMAKE_FLAGS: ${{matrix.config.cmakeflags}} -DCMAKE_VERBOSE_MAKEFILES=ON -DRYML_DEV=OFF -DRYML_API_TESTS=OFF -DRYML_API_BENCHMARKS=OFF
|
||||||
|
CIBW_BUILD: cp${{matrix.config.cibw_pyv}}-${{matrix.config.cibw_platform}}
|
||||||
|
CIBW_ARCHS: ${{matrix.config.cibw_arch}}
|
||||||
|
CIBW_BUILD_VERBOSITY: 2
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
config:: matrix
|
||||||
|
steps:
|
||||||
|
- :: checkout-action
|
||||||
|
- :: setup-env
|
||||||
|
- name: create wheel
|
||||||
|
uses: pypa/cibuildwheel@v2.23
|
||||||
|
- name: rename wheelhouse -> dist
|
||||||
|
run: mv -fv wheelhouse dist
|
||||||
|
- name: Verify artifacts
|
||||||
|
run: ls -lFhp dist/
|
||||||
|
- name: Save artifacts for publishing to PyPI
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with: {name: 'dist-${{matrix.config.sfx}}', path: dist/}
|
||||||
|
# run the tests
|
||||||
|
- name: install python ${{matrix.config.pythonv}}
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: ${{matrix.config.pythonv}}
|
||||||
|
- name: test with python ${{matrix.config.pythonv}}
|
||||||
|
run: |
|
||||||
|
set -x
|
||||||
|
echo "python ${{matrix.config.pythonv}} ${{matrix.config.py_arch}} ${{matrix.config.cibw_arch}}"
|
||||||
|
# skip 32 bit tests, as Python 32 bits are not available in ubuntu
|
||||||
|
arch="${{matrix.config.cibw_arch}}"
|
||||||
|
if [ "$arch" == "x86" ] || [ "$arch" == "i686" ] ; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
python --version
|
||||||
|
python -c 'import sys ; import struct ; print("python:", sys.version, struct.calcsize("P") * 8, "bits")'
|
||||||
|
pip --version
|
||||||
|
pip install -v -r requirements.txt
|
||||||
|
pip install -v -r api/python/requirements.txt
|
||||||
|
for whl in dist/* ; do
|
||||||
|
# verify that we can import the wheel files without installing the wheel
|
||||||
|
unzip -l $whl
|
||||||
|
mkdir -p tmpwhl
|
||||||
|
cd tmpwhl
|
||||||
|
unzip ../$whl
|
||||||
|
ls -lFpAR .
|
||||||
|
( export PYTHONPATH=`pwd`/ryml ; python -c 'import ryml' )
|
||||||
|
cd ..
|
||||||
|
rm -rf tmpwhl
|
||||||
|
# verify that we can install the wheel and then import it
|
||||||
|
pip install -v $whl
|
||||||
|
pip show -f rapidyaml
|
||||||
|
python -c 'import ryml'
|
||||||
|
python -c 'import ryml ; print("ryml", ryml.version, ryml.version_tuple)'
|
||||||
|
python -c 'import ryml ; tree = ryml.parse_in_arena(b"{foo: bar}") ; assert tree.key(1) == b"foo" ; assert tree.val(1) == b"bar" ; print(str(tree.key(1), "utf8")) ; print(str(tree.val(1), "utf8"))'
|
||||||
|
python -m pytest -vvv api/python/tests
|
||||||
|
pip uninstall -y -v rapidyaml
|
||||||
|
done
|
||||||
|
|
||||||
|
=>: nil # this is needed to expose the function above
|
||||||
|
|
||||||
env:
|
env:
|
||||||
PROJ_PKG_NAME: rapidyaml-
|
PROJ_PKG_NAME: rapidyaml-
|
||||||
@@ -101,7 +257,7 @@ jobs:
|
|||||||
- {name: MacOSX sh,
|
- {name: MacOSX sh,
|
||||||
sfxg: apple64.sh,
|
sfxg: apple64.sh,
|
||||||
sfxp: macosx-xcode.sh,
|
sfxp: macosx-xcode.sh,
|
||||||
gen: STGZ, mime: x-sh, os: macos-13, cxx: xcode}
|
gen: STGZ, mime: x-sh, os: macos-latest, cxx: xcode}
|
||||||
steps:
|
steps:
|
||||||
- :: checkout-action
|
- :: checkout-action
|
||||||
- :: version-get-vars
|
- :: version-get-vars
|
||||||
@@ -123,8 +279,6 @@ jobs:
|
|||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# create python packages
|
# create python packages
|
||||||
# adapted from
|
|
||||||
# github.com/pikepdf/pikepdf/blob/master/.github/workflows/build_wheels.yml
|
|
||||||
|
|
||||||
python_src:
|
python_src:
|
||||||
:: setup-job('release' 'python_src')
|
:: setup-job('release' 'python_src')
|
||||||
@@ -144,120 +298,16 @@ jobs:
|
|||||||
with: {name: dist-python_src, path: dist/}
|
with: {name: dist-python_src, path: dist/}
|
||||||
|
|
||||||
python_wheels:
|
python_wheels:
|
||||||
:: setup-job('release' 'python_wheels')
|
:: define-workflow-python-wheels('python_wheels' python-wheel-matrix setup-env)
|
||||||
name: ${{matrix.config.name}}
|
|
||||||
runs-on: ${{matrix.config.os}}
|
python_wheels_win:
|
||||||
env:
|
:: define-workflow-python-wheels('python_wheels_win' python-wheel-matrix-win setup-env-win)
|
||||||
CMAKE_FLAGS: ${{matrix.config.cmakeflags}} -DRYML_DEV=OFF -DRYML_BUILD_API=ON -DRYML_API_TESTS=OFF -DRYML_API_BENCHMARKS=OFF
|
|
||||||
CIBW_BUILD: cp${{matrix.config.cibw_pyv}}-${{matrix.config.cibw_platform}}
|
|
||||||
CIBW_ARCHS: ${{matrix.config.cibw_arch}}
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
# Local function to expand python entries:
|
|
||||||
python =:
|
|
||||||
fn(pyv cibwpyv cibwarch cibwplatform os cmkflags):: # NOTE: cannot use _ in names?
|
|
||||||
name:: "python/$pyv/$cibwplatform"
|
|
||||||
sfx:: "python$pyv-$cibwplatform" # suffix
|
|
||||||
os:: os
|
|
||||||
pythonv:: pyv
|
|
||||||
cibw_pyv:: cibwpyv
|
|
||||||
cibw_arch:: cibwarch
|
|
||||||
cibw_platform:: cibwplatform
|
|
||||||
cmakeflags:: cmkflags
|
|
||||||
config:
|
|
||||||
# pyv pyv arch platform os cmakeflags
|
|
||||||
- ! python('3.13' 313 'x86_64' 'manylinux_x86_64' 'ubuntu-24.04' '')
|
|
||||||
- ! python('3.13' 313 'i686' 'manylinux_i686' 'ubuntu-24.04' '')
|
|
||||||
#- ! python('3.13' 313 'AMD64' 'win_amd64' 'windows-2022' '-G "Visual Studio 16 2019" -A x64')
|
|
||||||
#- ! python('3.13' 313 'x86' 'win32' 'windows-2022' '-G "Visual Studio 16 2019" -A Win32')
|
|
||||||
#- ! python('3.13' 313 'x86_64' 'macosx_x86_64' 'macosx-10.15' '')
|
|
||||||
#
|
|
||||||
- ! python('3.12' 312 'x86_64' 'manylinux_x86_64' 'ubuntu-24.04' '')
|
|
||||||
- ! python('3.12' 312 'i686' 'manylinux_i686' 'ubuntu-24.04' '')
|
|
||||||
#- ! python('3.12' 312 'AMD64' 'win_amd64' 'windows-2022' '-G "Visual Studio 16 2019" -A x64')
|
|
||||||
#- ! python('3.12' 312 'x86' 'win32' 'windows-2022' '-G "Visual Studio 16 2019" -A Win32')
|
|
||||||
#- ! python('3.12' 312 'x86_64' 'macosx_x86_64' 'macosx-10.15' '')
|
|
||||||
#
|
|
||||||
- ! python('3.11' 311 'x86_64' 'manylinux_x86_64' 'ubuntu-24.04' '')
|
|
||||||
- ! python('3.11' 311 'i686' 'manylinux_i686' 'ubuntu-24.04' '')
|
|
||||||
#- ! python('3.11' 311 'AMD64' 'win_amd64' 'windows-2022' '-G "Visual Studio 16 2019" -A x64')
|
|
||||||
#- ! python('3.11' 311 'x86' 'win32' 'windows-2022' '-G "Visual Studio 16 2019" -A Win32')
|
|
||||||
#- ! python('3.11' 311 'x86_64' 'macosx_x86_64' 'macosx-10.15' '')
|
|
||||||
#
|
|
||||||
- ! python('3.10' 310 'x86_64' 'manylinux_x86_64' 'ubuntu-24.04' '')
|
|
||||||
- ! python('3.10' 310 'i686' 'manylinux_i686' 'ubuntu-24.04' '')
|
|
||||||
#- ! python('3.10' 310 'AMD64' 'win_amd64' 'windows-2022' '-G "Visual Studio 16 2019" -A x64')
|
|
||||||
#- ! python('3.10' 310 'x86' 'win32' 'windows-2022' '-G "Visual Studio 16 2019" -A Win32')
|
|
||||||
#- ! python('3.10' 310 'x86_64' 'macosx_x86_64' 'macosx-10.15' '')
|
|
||||||
#
|
|
||||||
- ! python('3.9' 39 'x86_64' 'manylinux_x86_64' 'ubuntu-24.04' '')
|
|
||||||
- ! python('3.9' 39 'i686' 'manylinux_i686' 'ubuntu-24.04' '')
|
|
||||||
#- ! python('3.9' 39 'AMD64' 'win_amd64' 'windows-2022' '-G "Visual Studio 16 2019" -A x64')
|
|
||||||
#- ! python('3.9' 39 'x86' 'win32' 'windows-2022' '-G "Visual Studio 16 2019" -A Win32')
|
|
||||||
#- ! python('3.9' 39 'x86_64' 'macosx_x86_64' 'macosx-10.15' '')
|
|
||||||
#
|
|
||||||
- ! python('3.8' 38 'x86_64' 'manylinux_x86_64' 'ubuntu-24.04' '')
|
|
||||||
- ! python('3.8' 38 'i686' 'manylinux_i686' 'ubuntu-24.04' '')
|
|
||||||
#- ! python('3.8' 38 'AMD64' 'win_amd64' 'windows-2022' '-G "Visual Studio 16 2019" -A x64')
|
|
||||||
#- ! python('3.8' 38 'x86' 'win32' 'windows-2022' '-G "Visual Studio 16 2019" -A Win32')
|
|
||||||
#- ! python('3.8' 38 'x86_64' 'macosx_x86_64' 'macosx-10.15' '')
|
|
||||||
#
|
|
||||||
- ! python('3.7' 37 'x86_64' 'manylinux_x86_64' 'ubuntu-22.04' '')
|
|
||||||
- ! python('3.7' 37 'i686' 'manylinux_i686' 'ubuntu-22.04' '')
|
|
||||||
#- ! python('3.7' 37 'AMD64' 'win_amd64' 'windows-2022' '-G "Visual Studio 16 2019" -A x64')
|
|
||||||
#- ! python('3.7' 37 'x86' 'win32' 'windows-2022' '-G "Visual Studio 16 2019" -A Win32')
|
|
||||||
#- ! python('3.7' 37 'x86_64' 'macosx_x86_64' 'macosx-10.15' '')
|
|
||||||
#
|
|
||||||
- ! python('3.6' 36 'x86_64' 'manylinux_x86_64' 'ubuntu-20.04' '') # setup-python 3.6 requires ubuntu 20.04
|
|
||||||
- ! python('3.6' 36 'i686' 'manylinux_i686' 'ubuntu-20.04' '') # setup-python 3.6 requires ubuntu 20.04
|
|
||||||
#- ! python('3.6' 36 'AMD64' 'win_amd64' 'windows-2022' '-G "Visual Studio 16 2019" -A x64')
|
|
||||||
#- ! python('3.6' 36 'x86' 'win32' 'windows-2022' '-G "Visual Studio 16 2019" -A Win32')
|
|
||||||
#- ! python('3.6' 36 'x86_64' 'macosx_x86_64' 'macosx-10.15' '')
|
|
||||||
steps:
|
|
||||||
- :: checkout-action
|
|
||||||
- name: create wheel
|
|
||||||
uses: pypa/cibuildwheel@v2.23
|
|
||||||
- name: rename wheelhouse -> dist
|
|
||||||
run: mv -fv wheelhouse dist
|
|
||||||
- name: Verify artifacts
|
|
||||||
run: ls -lFhp dist/
|
|
||||||
- name: Save artifacts for publishing to PyPI
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with: {name: 'dist-${{matrix.config.sfx}}', path: dist/}
|
|
||||||
# run the tests
|
|
||||||
- name: install python ${{matrix.config.pythonv}}
|
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: ${{matrix.config.pythonv}}
|
|
||||||
- name: test with python ${{matrix.config.pythonv}}
|
|
||||||
run: |
|
|
||||||
set -x
|
|
||||||
echo "python ${{matrix.config.pythonv}} ${{matrix.config.py_arch}} ${{matrix.config.cibw_arch}}"
|
|
||||||
# skip 32 bit tests, as Python 32 bits are not available in ubuntu
|
|
||||||
arch="${{matrix.config.cibw_arch}}"
|
|
||||||
if [ "$arch" == "x86" ] || [ "$arch" == "i686" ] ; then
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
python --version
|
|
||||||
python -c 'import sys ; import struct ; print("python:", sys.version, struct.calcsize("P") * 8, "bits")'
|
|
||||||
pip --version
|
|
||||||
pip install -v -r requirements.txt
|
|
||||||
pip install -v -r api/python/requirements.txt
|
|
||||||
for whl in dist/* ; do
|
|
||||||
pip install -v $whl
|
|
||||||
pip show -f rapidyaml
|
|
||||||
python -c 'import ryml ; print("ryml", ryml.version, ryml.version_tuple)'
|
|
||||||
python -c 'import ryml ; tree = ryml.parse_in_arena(b"{foo: bar}") ; assert tree.key(1) == b"foo" ; assert tree.val(1) == b"bar" ; print(str(tree.key(1), "utf8")) ; print(str(tree.val(1), "utf8"))'
|
|
||||||
python -m pytest -vvv api/python/tests
|
|
||||||
pip uninstall -y -v rapidyaml
|
|
||||||
done
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
merge_artifacts:
|
merge_artifacts:
|
||||||
:: setup-job('release' 'merge_artifacts')
|
:: setup-job('release' 'merge_artifacts')
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [src, cpp, python_src, python_wheels]
|
needs: [src, cpp, python_src, python_wheels, python_wheels_win]
|
||||||
steps:
|
steps:
|
||||||
- name: Merge assets artifacts
|
- name: Merge assets artifacts
|
||||||
uses: actions/upload-artifact/merge@v4
|
uses: actions/upload-artifact/merge@v4
|
||||||
|
|||||||
255
.github/workflows/api.yml
vendored
Normal file
255
.github/workflows/api.yml
vendored
Normal file
@@ -0,0 +1,255 @@
|
|||||||
|
# DO NOT EDIT - GENERATED FROM .github/workflows/api.ys
|
||||||
|
|
||||||
|
name: api
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash -e -x {0}
|
||||||
|
'on':
|
||||||
|
workflow_dispatch: null
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
env:
|
||||||
|
PROJ_PKG_NAME: rapidyaml-
|
||||||
|
PROJ_PFX_TARGET: ryml-
|
||||||
|
PROJ_PFX_CMAKE: RYML_
|
||||||
|
CMAKE_FLAGS: -DRYML_TEST_SUITE=ON
|
||||||
|
NUM_JOBS_BUILD: null
|
||||||
|
jobs:
|
||||||
|
pybare:
|
||||||
|
if: always()
|
||||||
|
continue-on-error: false
|
||||||
|
name: pybare/${{matrix.config.pythonv}}/${{matrix.config.os}}
|
||||||
|
runs-on: ${{matrix.config.os}}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
config:
|
||||||
|
- pythonv: '3.13'
|
||||||
|
os: ubuntu-latest
|
||||||
|
- pythonv: '3.13'
|
||||||
|
os: macos-13
|
||||||
|
steps:
|
||||||
|
- name: checkout (action)
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: install python ${{matrix.config.pythonv}}
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: ${{matrix.config.pythonv}}
|
||||||
|
- name: deps
|
||||||
|
run: |
|
||||||
|
if [[ "${{matrix.config.os}}" == macos* ]] ; then
|
||||||
|
brew install swig
|
||||||
|
elif [[ "${{matrix.config.os}}" == windows* ]] ; then
|
||||||
|
choco install swig
|
||||||
|
fi
|
||||||
|
pip install build deprecation pytest
|
||||||
|
pip install -r requirements.txt
|
||||||
|
- name: configure
|
||||||
|
run: |
|
||||||
|
cmake -B build/py \
|
||||||
|
-D CMAKE_BUILD_TYPE=Release \
|
||||||
|
-D BUILD_SHARED_LIBS=ON \
|
||||||
|
-D RYML_DEFAULT_CALLBACK_USES_EXCEPTIONS=ON \
|
||||||
|
-D RYML_BUILD_API=ON \
|
||||||
|
-D RYML_API_TESTS=ON \
|
||||||
|
-D RYML_BUILD_TESTS=ON
|
||||||
|
- name: build
|
||||||
|
run: |
|
||||||
|
cmake --build build/py -j -v --target ryml-api-python3
|
||||||
|
cp -fv api/python/ryml/__init__.py build/py/api/python3/.
|
||||||
|
ls -lFpAR build/py/api/python3/*
|
||||||
|
- name: test with ctest
|
||||||
|
run: |
|
||||||
|
export PYTHONPATH=`pwd`/build/py/api/python3:$PYTHONPATH
|
||||||
|
cmake --build build/py -j -v --target ryml-api-test-python3
|
||||||
|
- name: test with pytest
|
||||||
|
run: |
|
||||||
|
export PYTHONPATH=`pwd`/build/py/api/python3:$PYTHONPATH
|
||||||
|
python -m pytest -vvv api/python/tests
|
||||||
|
pybarewin:
|
||||||
|
if: always()
|
||||||
|
continue-on-error: false
|
||||||
|
name: pybare/${{matrix.config.pythonv}}/${{matrix.config.os}}
|
||||||
|
runs-on: ${{matrix.config.os}}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
config:
|
||||||
|
- pythonv: '3.13'
|
||||||
|
os: windows-latest
|
||||||
|
steps:
|
||||||
|
- name: checkout (action)
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: install python ${{matrix.config.pythonv}}
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: ${{matrix.config.pythonv}}
|
||||||
|
- name: deps
|
||||||
|
run: |
|
||||||
|
if [[ "${{matrix.config.os}}" == macos* ]] ; then
|
||||||
|
brew install swig
|
||||||
|
elif [[ "${{matrix.config.os}}" == windows* ]] ; then
|
||||||
|
choco install swig
|
||||||
|
fi
|
||||||
|
pip install build deprecation pytest
|
||||||
|
pip install -r requirements.txt
|
||||||
|
- name: setup env (Visual Studio)
|
||||||
|
uses: TheMrMilchmann/setup-msvc-dev@v3
|
||||||
|
with:
|
||||||
|
arch: ${{matrix.config.vsenvarch}}
|
||||||
|
- name: configure
|
||||||
|
run: |
|
||||||
|
cmake -B build/py \
|
||||||
|
-D CMAKE_BUILD_TYPE=Release \
|
||||||
|
-D BUILD_SHARED_LIBS=ON \
|
||||||
|
-D RYML_DEFAULT_CALLBACK_USES_EXCEPTIONS=ON \
|
||||||
|
-D RYML_BUILD_API=ON \
|
||||||
|
-D RYML_API_TESTS=ON \
|
||||||
|
-D RYML_BUILD_TESTS=ON
|
||||||
|
- name: build
|
||||||
|
run: |
|
||||||
|
cmake --build build/py -j -v --target ryml-api-python3
|
||||||
|
cp -fv api/python/ryml/__init__.py build/py/api/python3/.
|
||||||
|
ls -lFpAR build/py/api/python3/*
|
||||||
|
- name: test with ctest
|
||||||
|
run: |
|
||||||
|
export PYTHONPATH=`pwd`/build/py/api/python3:$PYTHONPATH
|
||||||
|
cmake --build build/py -j -v --target ryml-api-test-python3
|
||||||
|
- name: test with pytest
|
||||||
|
run: |
|
||||||
|
export PYTHONPATH=`pwd`/build/py/api/python3:$PYTHONPATH
|
||||||
|
python -m pytest -vvv api/python/tests
|
||||||
|
pywheel:
|
||||||
|
if: always()
|
||||||
|
continue-on-error: false
|
||||||
|
name: pywheel/${{matrix.config.pythonv}}/${{matrix.config.os}}
|
||||||
|
runs-on: ${{matrix.config.os}}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
config:
|
||||||
|
- pythonv: '3.13'
|
||||||
|
os: ubuntu-latest
|
||||||
|
- pythonv: '3.13'
|
||||||
|
os: macos-13
|
||||||
|
env:
|
||||||
|
CMAKE_FLAGS: -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILES=ON
|
||||||
|
steps:
|
||||||
|
- name: checkout (action)
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: install python ${{matrix.config.pythonv}}
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: ${{matrix.config.pythonv}}
|
||||||
|
- name: deps
|
||||||
|
run: |
|
||||||
|
if [[ "${{matrix.config.os}}" == macos* ]] ; then
|
||||||
|
brew install swig
|
||||||
|
elif [[ "${{matrix.config.os}}" == windows* ]] ; then
|
||||||
|
choco install swig
|
||||||
|
fi
|
||||||
|
pip install build deprecation pytest
|
||||||
|
pip install -r requirements.txt
|
||||||
|
- name: '------------------- using setup.py'
|
||||||
|
run: rm -rf build/ dist/
|
||||||
|
- name: create wheel with python setup.py bdist_wheel -v
|
||||||
|
run: |
|
||||||
|
python setup.py bdist_wheel -v
|
||||||
|
- name: install wheel
|
||||||
|
run: pip install dist/*.whl
|
||||||
|
- name: test with pytest
|
||||||
|
run: python -m pytest -vvv api/python/tests
|
||||||
|
- name: '------------------- using pip'
|
||||||
|
run: rm -rf build/ dist/
|
||||||
|
- name: create wheel with pip wheel -w dist/ .
|
||||||
|
run: |
|
||||||
|
pip wheel -w dist/ .
|
||||||
|
- name: install wheel
|
||||||
|
run: pip install dist/*.whl
|
||||||
|
- name: test with pytest
|
||||||
|
run: python -m pytest -vvv api/python/tests
|
||||||
|
- name: '------------------- using pypa/build'
|
||||||
|
run: rm -rf build/ dist/
|
||||||
|
- name: create wheel with python -m build --wheel
|
||||||
|
run: |
|
||||||
|
python -m build --wheel
|
||||||
|
- name: install wheel
|
||||||
|
run: pip install dist/*.whl
|
||||||
|
- name: test with pytest
|
||||||
|
run: python -m pytest -vvv api/python/tests
|
||||||
|
pywheelwin:
|
||||||
|
if: always()
|
||||||
|
continue-on-error: false
|
||||||
|
name: pywheel/${{matrix.config.pythonv}}/${{matrix.config.os}}
|
||||||
|
runs-on: ${{matrix.config.os}}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
config:
|
||||||
|
- pythonv: '3.13'
|
||||||
|
os: windows-latest
|
||||||
|
env:
|
||||||
|
CMAKE_FLAGS: -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILES=ON
|
||||||
|
steps:
|
||||||
|
- name: checkout (action)
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: install python ${{matrix.config.pythonv}}
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: ${{matrix.config.pythonv}}
|
||||||
|
- name: deps
|
||||||
|
run: |
|
||||||
|
if [[ "${{matrix.config.os}}" == macos* ]] ; then
|
||||||
|
brew install swig
|
||||||
|
elif [[ "${{matrix.config.os}}" == windows* ]] ; then
|
||||||
|
choco install swig
|
||||||
|
fi
|
||||||
|
pip install build deprecation pytest
|
||||||
|
pip install -r requirements.txt
|
||||||
|
- name: setup env (Visual Studio)
|
||||||
|
uses: TheMrMilchmann/setup-msvc-dev@v3
|
||||||
|
with:
|
||||||
|
arch: ${{matrix.config.vsenvarch}}
|
||||||
|
- name: '------------------- using setup.py'
|
||||||
|
run: rm -rf build/ dist/
|
||||||
|
- name: create wheel with python setup.py bdist_wheel -v
|
||||||
|
run: |
|
||||||
|
python setup.py bdist_wheel -v
|
||||||
|
- name: install wheel
|
||||||
|
run: pip install dist/*.whl
|
||||||
|
- name: test with pytest
|
||||||
|
run: python -m pytest -vvv api/python/tests
|
||||||
|
- name: '------------------- using pip'
|
||||||
|
run: rm -rf build/ dist/
|
||||||
|
- name: create wheel with pip wheel -w dist/ .
|
||||||
|
run: |
|
||||||
|
pip wheel -w dist/ .
|
||||||
|
- name: install wheel
|
||||||
|
run: pip install dist/*.whl
|
||||||
|
- name: test with pytest
|
||||||
|
run: python -m pytest -vvv api/python/tests
|
||||||
|
- name: '------------------- using pypa/build'
|
||||||
|
run: rm -rf build/ dist/
|
||||||
|
- name: create wheel with python -m build --wheel
|
||||||
|
run: |
|
||||||
|
python -m build --wheel
|
||||||
|
- name: install wheel
|
||||||
|
run: pip install dist/*.whl
|
||||||
|
- name: test with pytest
|
||||||
|
run: python -m pytest -vvv api/python/tests
|
||||||
307
.github/workflows/release.yml
vendored
307
.github/workflows/release.yml
vendored
@@ -190,7 +190,7 @@ jobs:
|
|||||||
sfxp: macosx-xcode.sh
|
sfxp: macosx-xcode.sh
|
||||||
gen: STGZ
|
gen: STGZ
|
||||||
mime: x-sh
|
mime: x-sh
|
||||||
os: macos-13
|
os: macos-latest
|
||||||
cxx: xcode
|
cxx: xcode
|
||||||
steps:
|
steps:
|
||||||
- name: checkout (action)
|
- name: checkout (action)
|
||||||
@@ -283,9 +283,10 @@ jobs:
|
|||||||
name: ${{matrix.config.name}}
|
name: ${{matrix.config.name}}
|
||||||
runs-on: ${{matrix.config.os}}
|
runs-on: ${{matrix.config.os}}
|
||||||
env:
|
env:
|
||||||
CMAKE_FLAGS: ${{matrix.config.cmakeflags}} -DRYML_DEV=OFF -DRYML_BUILD_API=ON -DRYML_API_TESTS=OFF -DRYML_API_BENCHMARKS=OFF
|
CMAKE_FLAGS: ${{matrix.config.cmakeflags}} -DCMAKE_VERBOSE_MAKEFILES=ON -DRYML_DEV=OFF -DRYML_API_TESTS=OFF -DRYML_API_BENCHMARKS=OFF
|
||||||
CIBW_BUILD: cp${{matrix.config.cibw_pyv}}-${{matrix.config.cibw_platform}}
|
CIBW_BUILD: cp${{matrix.config.cibw_pyv}}-${{matrix.config.cibw_platform}}
|
||||||
CIBW_ARCHS: ${{matrix.config.cibw_arch}}
|
CIBW_ARCHS: ${{matrix.config.cibw_arch}}
|
||||||
|
CIBW_BUILD_VERBOSITY: 2
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@@ -297,7 +298,7 @@ jobs:
|
|||||||
cibw_pyv: 313
|
cibw_pyv: 313
|
||||||
cibw_arch: x86_64
|
cibw_arch: x86_64
|
||||||
cibw_platform: manylinux_x86_64
|
cibw_platform: manylinux_x86_64
|
||||||
cmakeflags: ''
|
vsenvarch: ''
|
||||||
- name: python/3.13/manylinux_i686
|
- name: python/3.13/manylinux_i686
|
||||||
sfx: python3.13-manylinux_i686
|
sfx: python3.13-manylinux_i686
|
||||||
os: ubuntu-24.04
|
os: ubuntu-24.04
|
||||||
@@ -305,7 +306,15 @@ jobs:
|
|||||||
cibw_pyv: 313
|
cibw_pyv: 313
|
||||||
cibw_arch: i686
|
cibw_arch: i686
|
||||||
cibw_platform: manylinux_i686
|
cibw_platform: manylinux_i686
|
||||||
cmakeflags: ''
|
vsenvarch: ''
|
||||||
|
- name: python/3.13/macosx_x86_64
|
||||||
|
sfx: python3.13-macosx_x86_64
|
||||||
|
os: macos-13
|
||||||
|
pythonv: '3.13'
|
||||||
|
cibw_pyv: 313
|
||||||
|
cibw_arch: x86_64
|
||||||
|
cibw_platform: macosx_x86_64
|
||||||
|
vsenvarch: ''
|
||||||
- name: python/3.12/manylinux_x86_64
|
- name: python/3.12/manylinux_x86_64
|
||||||
sfx: python3.12-manylinux_x86_64
|
sfx: python3.12-manylinux_x86_64
|
||||||
os: ubuntu-24.04
|
os: ubuntu-24.04
|
||||||
@@ -313,7 +322,7 @@ jobs:
|
|||||||
cibw_pyv: 312
|
cibw_pyv: 312
|
||||||
cibw_arch: x86_64
|
cibw_arch: x86_64
|
||||||
cibw_platform: manylinux_x86_64
|
cibw_platform: manylinux_x86_64
|
||||||
cmakeflags: ''
|
vsenvarch: ''
|
||||||
- name: python/3.12/manylinux_i686
|
- name: python/3.12/manylinux_i686
|
||||||
sfx: python3.12-manylinux_i686
|
sfx: python3.12-manylinux_i686
|
||||||
os: ubuntu-24.04
|
os: ubuntu-24.04
|
||||||
@@ -321,7 +330,15 @@ jobs:
|
|||||||
cibw_pyv: 312
|
cibw_pyv: 312
|
||||||
cibw_arch: i686
|
cibw_arch: i686
|
||||||
cibw_platform: manylinux_i686
|
cibw_platform: manylinux_i686
|
||||||
cmakeflags: ''
|
vsenvarch: ''
|
||||||
|
- name: python/3.12/macosx_x86_64
|
||||||
|
sfx: python3.12-macosx_x86_64
|
||||||
|
os: macos-13
|
||||||
|
pythonv: '3.12'
|
||||||
|
cibw_pyv: 312
|
||||||
|
cibw_arch: x86_64
|
||||||
|
cibw_platform: macosx_x86_64
|
||||||
|
vsenvarch: ''
|
||||||
- name: python/3.11/manylinux_x86_64
|
- name: python/3.11/manylinux_x86_64
|
||||||
sfx: python3.11-manylinux_x86_64
|
sfx: python3.11-manylinux_x86_64
|
||||||
os: ubuntu-24.04
|
os: ubuntu-24.04
|
||||||
@@ -329,7 +346,7 @@ jobs:
|
|||||||
cibw_pyv: 311
|
cibw_pyv: 311
|
||||||
cibw_arch: x86_64
|
cibw_arch: x86_64
|
||||||
cibw_platform: manylinux_x86_64
|
cibw_platform: manylinux_x86_64
|
||||||
cmakeflags: ''
|
vsenvarch: ''
|
||||||
- name: python/3.11/manylinux_i686
|
- name: python/3.11/manylinux_i686
|
||||||
sfx: python3.11-manylinux_i686
|
sfx: python3.11-manylinux_i686
|
||||||
os: ubuntu-24.04
|
os: ubuntu-24.04
|
||||||
@@ -337,7 +354,15 @@ jobs:
|
|||||||
cibw_pyv: 311
|
cibw_pyv: 311
|
||||||
cibw_arch: i686
|
cibw_arch: i686
|
||||||
cibw_platform: manylinux_i686
|
cibw_platform: manylinux_i686
|
||||||
cmakeflags: ''
|
vsenvarch: ''
|
||||||
|
- name: python/3.11/macosx_x86_64
|
||||||
|
sfx: python3.11-macosx_x86_64
|
||||||
|
os: macos-13
|
||||||
|
pythonv: '3.11'
|
||||||
|
cibw_pyv: 311
|
||||||
|
cibw_arch: x86_64
|
||||||
|
cibw_platform: macosx_x86_64
|
||||||
|
vsenvarch: ''
|
||||||
- name: python/3.10/manylinux_x86_64
|
- name: python/3.10/manylinux_x86_64
|
||||||
sfx: python3.10-manylinux_x86_64
|
sfx: python3.10-manylinux_x86_64
|
||||||
os: ubuntu-24.04
|
os: ubuntu-24.04
|
||||||
@@ -345,7 +370,7 @@ jobs:
|
|||||||
cibw_pyv: 310
|
cibw_pyv: 310
|
||||||
cibw_arch: x86_64
|
cibw_arch: x86_64
|
||||||
cibw_platform: manylinux_x86_64
|
cibw_platform: manylinux_x86_64
|
||||||
cmakeflags: ''
|
vsenvarch: ''
|
||||||
- name: python/3.10/manylinux_i686
|
- name: python/3.10/manylinux_i686
|
||||||
sfx: python3.10-manylinux_i686
|
sfx: python3.10-manylinux_i686
|
||||||
os: ubuntu-24.04
|
os: ubuntu-24.04
|
||||||
@@ -353,7 +378,15 @@ jobs:
|
|||||||
cibw_pyv: 310
|
cibw_pyv: 310
|
||||||
cibw_arch: i686
|
cibw_arch: i686
|
||||||
cibw_platform: manylinux_i686
|
cibw_platform: manylinux_i686
|
||||||
cmakeflags: ''
|
vsenvarch: ''
|
||||||
|
- name: python/3.10/macosx_x86_64
|
||||||
|
sfx: python3.10-macosx_x86_64
|
||||||
|
os: macos-13
|
||||||
|
pythonv: '3.10'
|
||||||
|
cibw_pyv: 310
|
||||||
|
cibw_arch: x86_64
|
||||||
|
cibw_platform: macosx_x86_64
|
||||||
|
vsenvarch: ''
|
||||||
- name: python/3.9/manylinux_x86_64
|
- name: python/3.9/manylinux_x86_64
|
||||||
sfx: python3.9-manylinux_x86_64
|
sfx: python3.9-manylinux_x86_64
|
||||||
os: ubuntu-24.04
|
os: ubuntu-24.04
|
||||||
@@ -361,7 +394,7 @@ jobs:
|
|||||||
cibw_pyv: 39
|
cibw_pyv: 39
|
||||||
cibw_arch: x86_64
|
cibw_arch: x86_64
|
||||||
cibw_platform: manylinux_x86_64
|
cibw_platform: manylinux_x86_64
|
||||||
cmakeflags: ''
|
vsenvarch: ''
|
||||||
- name: python/3.9/manylinux_i686
|
- name: python/3.9/manylinux_i686
|
||||||
sfx: python3.9-manylinux_i686
|
sfx: python3.9-manylinux_i686
|
||||||
os: ubuntu-24.04
|
os: ubuntu-24.04
|
||||||
@@ -369,7 +402,15 @@ jobs:
|
|||||||
cibw_pyv: 39
|
cibw_pyv: 39
|
||||||
cibw_arch: i686
|
cibw_arch: i686
|
||||||
cibw_platform: manylinux_i686
|
cibw_platform: manylinux_i686
|
||||||
cmakeflags: ''
|
vsenvarch: ''
|
||||||
|
- name: python/3.9/macosx_x86_64
|
||||||
|
sfx: python3.9-macosx_x86_64
|
||||||
|
os: macos-13
|
||||||
|
pythonv: '3.9'
|
||||||
|
cibw_pyv: 39
|
||||||
|
cibw_arch: x86_64
|
||||||
|
cibw_platform: macosx_x86_64
|
||||||
|
vsenvarch: ''
|
||||||
- name: python/3.8/manylinux_x86_64
|
- name: python/3.8/manylinux_x86_64
|
||||||
sfx: python3.8-manylinux_x86_64
|
sfx: python3.8-manylinux_x86_64
|
||||||
os: ubuntu-24.04
|
os: ubuntu-24.04
|
||||||
@@ -377,7 +418,7 @@ jobs:
|
|||||||
cibw_pyv: 38
|
cibw_pyv: 38
|
||||||
cibw_arch: x86_64
|
cibw_arch: x86_64
|
||||||
cibw_platform: manylinux_x86_64
|
cibw_platform: manylinux_x86_64
|
||||||
cmakeflags: ''
|
vsenvarch: ''
|
||||||
- name: python/3.8/manylinux_i686
|
- name: python/3.8/manylinux_i686
|
||||||
sfx: python3.8-manylinux_i686
|
sfx: python3.8-manylinux_i686
|
||||||
os: ubuntu-24.04
|
os: ubuntu-24.04
|
||||||
@@ -385,7 +426,15 @@ jobs:
|
|||||||
cibw_pyv: 38
|
cibw_pyv: 38
|
||||||
cibw_arch: i686
|
cibw_arch: i686
|
||||||
cibw_platform: manylinux_i686
|
cibw_platform: manylinux_i686
|
||||||
cmakeflags: ''
|
vsenvarch: ''
|
||||||
|
- name: python/3.8/macosx_x86_64
|
||||||
|
sfx: python3.8-macosx_x86_64
|
||||||
|
os: macos-13
|
||||||
|
pythonv: '3.8'
|
||||||
|
cibw_pyv: 38
|
||||||
|
cibw_arch: x86_64
|
||||||
|
cibw_platform: macosx_x86_64
|
||||||
|
vsenvarch: ''
|
||||||
- name: python/3.7/manylinux_x86_64
|
- name: python/3.7/manylinux_x86_64
|
||||||
sfx: python3.7-manylinux_x86_64
|
sfx: python3.7-manylinux_x86_64
|
||||||
os: ubuntu-22.04
|
os: ubuntu-22.04
|
||||||
@@ -393,7 +442,7 @@ jobs:
|
|||||||
cibw_pyv: 37
|
cibw_pyv: 37
|
||||||
cibw_arch: x86_64
|
cibw_arch: x86_64
|
||||||
cibw_platform: manylinux_x86_64
|
cibw_platform: manylinux_x86_64
|
||||||
cmakeflags: ''
|
vsenvarch: ''
|
||||||
- name: python/3.7/manylinux_i686
|
- name: python/3.7/manylinux_i686
|
||||||
sfx: python3.7-manylinux_i686
|
sfx: python3.7-manylinux_i686
|
||||||
os: ubuntu-22.04
|
os: ubuntu-22.04
|
||||||
@@ -401,7 +450,15 @@ jobs:
|
|||||||
cibw_pyv: 37
|
cibw_pyv: 37
|
||||||
cibw_arch: i686
|
cibw_arch: i686
|
||||||
cibw_platform: manylinux_i686
|
cibw_platform: manylinux_i686
|
||||||
cmakeflags: ''
|
vsenvarch: ''
|
||||||
|
- name: python/3.7/macosx_x86_64
|
||||||
|
sfx: python3.7-macosx_x86_64
|
||||||
|
os: macos-13
|
||||||
|
pythonv: '3.7'
|
||||||
|
cibw_pyv: 37
|
||||||
|
cibw_arch: x86_64
|
||||||
|
cibw_platform: macosx_x86_64
|
||||||
|
vsenvarch: ''
|
||||||
- name: python/3.6/manylinux_x86_64
|
- name: python/3.6/manylinux_x86_64
|
||||||
sfx: python3.6-manylinux_x86_64
|
sfx: python3.6-manylinux_x86_64
|
||||||
os: ubuntu-20.04
|
os: ubuntu-20.04
|
||||||
@@ -409,7 +466,7 @@ jobs:
|
|||||||
cibw_pyv: 36
|
cibw_pyv: 36
|
||||||
cibw_arch: x86_64
|
cibw_arch: x86_64
|
||||||
cibw_platform: manylinux_x86_64
|
cibw_platform: manylinux_x86_64
|
||||||
cmakeflags: ''
|
vsenvarch: ''
|
||||||
- name: python/3.6/manylinux_i686
|
- name: python/3.6/manylinux_i686
|
||||||
sfx: python3.6-manylinux_i686
|
sfx: python3.6-manylinux_i686
|
||||||
os: ubuntu-20.04
|
os: ubuntu-20.04
|
||||||
@@ -417,13 +474,23 @@ jobs:
|
|||||||
cibw_pyv: 36
|
cibw_pyv: 36
|
||||||
cibw_arch: i686
|
cibw_arch: i686
|
||||||
cibw_platform: manylinux_i686
|
cibw_platform: manylinux_i686
|
||||||
cmakeflags: ''
|
vsenvarch: ''
|
||||||
|
- name: python/3.6/macosx_x86_64
|
||||||
|
sfx: python3.6-macosx_x86_64
|
||||||
|
os: macos-13
|
||||||
|
pythonv: '3.6'
|
||||||
|
cibw_pyv: 36
|
||||||
|
cibw_arch: x86_64
|
||||||
|
cibw_platform: macosx_x86_64
|
||||||
|
vsenvarch: ''
|
||||||
steps:
|
steps:
|
||||||
- name: checkout (action)
|
- name: checkout (action)
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
- name: setup env (non-win)
|
||||||
|
run: echo 'nothing to do'
|
||||||
- name: create wheel
|
- name: create wheel
|
||||||
uses: pypa/cibuildwheel@v2.23
|
uses: pypa/cibuildwheel@v2.23
|
||||||
- name: rename wheelhouse -> dist
|
- name: rename wheelhouse -> dist
|
||||||
@@ -454,8 +521,211 @@ jobs:
|
|||||||
pip install -v -r requirements.txt
|
pip install -v -r requirements.txt
|
||||||
pip install -v -r api/python/requirements.txt
|
pip install -v -r api/python/requirements.txt
|
||||||
for whl in dist/* ; do
|
for whl in dist/* ; do
|
||||||
|
# verify that we can import the wheel files without installing the wheel
|
||||||
|
unzip -l $whl
|
||||||
|
mkdir -p tmpwhl
|
||||||
|
cd tmpwhl
|
||||||
|
unzip ../$whl
|
||||||
|
ls -lFpAR .
|
||||||
|
( export PYTHONPATH=`pwd`/ryml ; python -c 'import ryml' )
|
||||||
|
cd ..
|
||||||
|
rm -rf tmpwhl
|
||||||
|
# verify that we can install the wheel and then import it
|
||||||
pip install -v $whl
|
pip install -v $whl
|
||||||
pip show -f rapidyaml
|
pip show -f rapidyaml
|
||||||
|
python -c 'import ryml'
|
||||||
|
python -c 'import ryml ; print("ryml", ryml.version, ryml.version_tuple)'
|
||||||
|
python -c 'import ryml ; tree = ryml.parse_in_arena(b"{foo: bar}") ; assert tree.key(1) == b"foo" ; assert tree.val(1) == b"bar" ; print(str(tree.key(1), "utf8")) ; print(str(tree.val(1), "utf8"))'
|
||||||
|
python -m pytest -vvv api/python/tests
|
||||||
|
pip uninstall -y -v rapidyaml
|
||||||
|
done
|
||||||
|
python_wheels_win:
|
||||||
|
if: always()
|
||||||
|
continue-on-error: false
|
||||||
|
name: ${{matrix.config.name}}
|
||||||
|
runs-on: ${{matrix.config.os}}
|
||||||
|
env:
|
||||||
|
CMAKE_FLAGS: ${{matrix.config.cmakeflags}} -DCMAKE_VERBOSE_MAKEFILES=ON -DRYML_DEV=OFF -DRYML_API_TESTS=OFF -DRYML_API_BENCHMARKS=OFF
|
||||||
|
CIBW_BUILD: cp${{matrix.config.cibw_pyv}}-${{matrix.config.cibw_platform}}
|
||||||
|
CIBW_ARCHS: ${{matrix.config.cibw_arch}}
|
||||||
|
CIBW_BUILD_VERBOSITY: 2
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
config:
|
||||||
|
- name: python/3.13/win_amd64
|
||||||
|
sfx: python3.13-win_amd64
|
||||||
|
os: windows-2022
|
||||||
|
pythonv: '3.13'
|
||||||
|
cibw_pyv: 313
|
||||||
|
cibw_arch: AMD64
|
||||||
|
cibw_platform: win_amd64
|
||||||
|
vsenvarch: x64
|
||||||
|
- name: python/3.13/win32
|
||||||
|
sfx: python3.13-win32
|
||||||
|
os: windows-2022
|
||||||
|
pythonv: '3.13'
|
||||||
|
cibw_pyv: 313
|
||||||
|
cibw_arch: x86
|
||||||
|
cibw_platform: win32
|
||||||
|
vsenvarch: x86
|
||||||
|
- name: python/3.12/win_amd64
|
||||||
|
sfx: python3.12-win_amd64
|
||||||
|
os: windows-2022
|
||||||
|
pythonv: '3.12'
|
||||||
|
cibw_pyv: 312
|
||||||
|
cibw_arch: AMD64
|
||||||
|
cibw_platform: win_amd64
|
||||||
|
vsenvarch: x64
|
||||||
|
- name: python/3.12/win32
|
||||||
|
sfx: python3.12-win32
|
||||||
|
os: windows-2022
|
||||||
|
pythonv: '3.12'
|
||||||
|
cibw_pyv: 312
|
||||||
|
cibw_arch: x86
|
||||||
|
cibw_platform: win32
|
||||||
|
vsenvarch: x86
|
||||||
|
- name: python/3.11/win_amd64
|
||||||
|
sfx: python3.11-win_amd64
|
||||||
|
os: windows-2022
|
||||||
|
pythonv: '3.11'
|
||||||
|
cibw_pyv: 311
|
||||||
|
cibw_arch: AMD64
|
||||||
|
cibw_platform: win_amd64
|
||||||
|
vsenvarch: x64
|
||||||
|
- name: python/3.11/win32
|
||||||
|
sfx: python3.11-win32
|
||||||
|
os: windows-2022
|
||||||
|
pythonv: '3.11'
|
||||||
|
cibw_pyv: 311
|
||||||
|
cibw_arch: x86
|
||||||
|
cibw_platform: win32
|
||||||
|
vsenvarch: x86
|
||||||
|
- name: python/3.10/win_amd64
|
||||||
|
sfx: python3.10-win_amd64
|
||||||
|
os: windows-2022
|
||||||
|
pythonv: '3.10'
|
||||||
|
cibw_pyv: 310
|
||||||
|
cibw_arch: AMD64
|
||||||
|
cibw_platform: win_amd64
|
||||||
|
vsenvarch: x64
|
||||||
|
- name: python/3.10/win32
|
||||||
|
sfx: python3.10-win32
|
||||||
|
os: windows-2022
|
||||||
|
pythonv: '3.10'
|
||||||
|
cibw_pyv: 310
|
||||||
|
cibw_arch: x86
|
||||||
|
cibw_platform: win32
|
||||||
|
vsenvarch: x86
|
||||||
|
- name: python/3.9/win_amd64
|
||||||
|
sfx: python3.9-win_amd64
|
||||||
|
os: windows-2022
|
||||||
|
pythonv: '3.9'
|
||||||
|
cibw_pyv: 39
|
||||||
|
cibw_arch: AMD64
|
||||||
|
cibw_platform: win_amd64
|
||||||
|
vsenvarch: x64
|
||||||
|
- name: python/3.9/win32
|
||||||
|
sfx: python3.9-win32
|
||||||
|
os: windows-2022
|
||||||
|
pythonv: '3.9'
|
||||||
|
cibw_pyv: 39
|
||||||
|
cibw_arch: x86
|
||||||
|
cibw_platform: win32
|
||||||
|
vsenvarch: x86
|
||||||
|
- name: python/3.8/win_amd64
|
||||||
|
sfx: python3.8-win_amd64
|
||||||
|
os: windows-2022
|
||||||
|
pythonv: '3.8'
|
||||||
|
cibw_pyv: 38
|
||||||
|
cibw_arch: AMD64
|
||||||
|
cibw_platform: win_amd64
|
||||||
|
vsenvarch: x64
|
||||||
|
- name: python/3.8/win32
|
||||||
|
sfx: python3.8-win32
|
||||||
|
os: windows-2022
|
||||||
|
pythonv: '3.8'
|
||||||
|
cibw_pyv: 38
|
||||||
|
cibw_arch: x86
|
||||||
|
cibw_platform: win32
|
||||||
|
vsenvarch: x86
|
||||||
|
- name: python/3.7/win_amd64
|
||||||
|
sfx: python3.7-win_amd64
|
||||||
|
os: windows-2022
|
||||||
|
pythonv: '3.7'
|
||||||
|
cibw_pyv: 37
|
||||||
|
cibw_arch: AMD64
|
||||||
|
cibw_platform: win_amd64
|
||||||
|
vsenvarch: x64
|
||||||
|
- name: python/3.6/win_amd64
|
||||||
|
sfx: python3.6-win_amd64
|
||||||
|
os: windows-2022
|
||||||
|
pythonv: '3.6'
|
||||||
|
cibw_pyv: 36
|
||||||
|
cibw_arch: AMD64
|
||||||
|
cibw_platform: win_amd64
|
||||||
|
vsenvarch: x64
|
||||||
|
- name: python/3.6/win32
|
||||||
|
sfx: python3.6-win32
|
||||||
|
os: windows-2022
|
||||||
|
pythonv: '3.6'
|
||||||
|
cibw_pyv: 36
|
||||||
|
cibw_arch: x86
|
||||||
|
cibw_platform: win32
|
||||||
|
vsenvarch: x86
|
||||||
|
steps:
|
||||||
|
- name: checkout (action)
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: setup env (Visual Studio)
|
||||||
|
uses: TheMrMilchmann/setup-msvc-dev@v3
|
||||||
|
with:
|
||||||
|
arch: ${{matrix.config.vsenvarch}}
|
||||||
|
- name: create wheel
|
||||||
|
uses: pypa/cibuildwheel@v2.23
|
||||||
|
- name: rename wheelhouse -> dist
|
||||||
|
run: mv -fv wheelhouse dist
|
||||||
|
- name: Verify artifacts
|
||||||
|
run: ls -lFhp dist/
|
||||||
|
- name: Save artifacts for publishing to PyPI
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: dist-${{matrix.config.sfx}}
|
||||||
|
path: dist/
|
||||||
|
- name: install python ${{matrix.config.pythonv}}
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: ${{matrix.config.pythonv}}
|
||||||
|
- name: test with python ${{matrix.config.pythonv}}
|
||||||
|
run: |
|
||||||
|
set -x
|
||||||
|
echo "python ${{matrix.config.pythonv}} ${{matrix.config.py_arch}} ${{matrix.config.cibw_arch}}"
|
||||||
|
# skip 32 bit tests, as Python 32 bits are not available in ubuntu
|
||||||
|
arch="${{matrix.config.cibw_arch}}"
|
||||||
|
if [ "$arch" == "x86" ] || [ "$arch" == "i686" ] ; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
python --version
|
||||||
|
python -c 'import sys ; import struct ; print("python:", sys.version, struct.calcsize("P") * 8, "bits")'
|
||||||
|
pip --version
|
||||||
|
pip install -v -r requirements.txt
|
||||||
|
pip install -v -r api/python/requirements.txt
|
||||||
|
for whl in dist/* ; do
|
||||||
|
# verify that we can import the wheel files without installing the wheel
|
||||||
|
unzip -l $whl
|
||||||
|
mkdir -p tmpwhl
|
||||||
|
cd tmpwhl
|
||||||
|
unzip ../$whl
|
||||||
|
ls -lFpAR .
|
||||||
|
( export PYTHONPATH=`pwd`/ryml ; python -c 'import ryml' )
|
||||||
|
cd ..
|
||||||
|
rm -rf tmpwhl
|
||||||
|
# verify that we can install the wheel and then import it
|
||||||
|
pip install -v $whl
|
||||||
|
pip show -f rapidyaml
|
||||||
|
python -c 'import ryml'
|
||||||
python -c 'import ryml ; print("ryml", ryml.version, ryml.version_tuple)'
|
python -c 'import ryml ; print("ryml", ryml.version, ryml.version_tuple)'
|
||||||
python -c 'import ryml ; tree = ryml.parse_in_arena(b"{foo: bar}") ; assert tree.key(1) == b"foo" ; assert tree.val(1) == b"bar" ; print(str(tree.key(1), "utf8")) ; print(str(tree.val(1), "utf8"))'
|
python -c 'import ryml ; tree = ryml.parse_in_arena(b"{foo: bar}") ; assert tree.key(1) == b"foo" ; assert tree.val(1) == b"bar" ; print(str(tree.key(1), "utf8")) ; print(str(tree.val(1), "utf8"))'
|
||||||
python -m pytest -vvv api/python/tests
|
python -m pytest -vvv api/python/tests
|
||||||
@@ -470,6 +740,7 @@ jobs:
|
|||||||
- cpp
|
- cpp
|
||||||
- python_src
|
- python_src
|
||||||
- python_wheels
|
- python_wheels
|
||||||
|
- python_wheels_win
|
||||||
steps:
|
steps:
|
||||||
- name: Merge assets artifacts
|
- name: Merge assets artifacts
|
||||||
uses: actions/upload-artifact/merge@v4
|
uses: actions/upload-artifact/merge@v4
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ if(RYML_BUILD_API_PYTHON)
|
|||||||
c4_set_folder_remote_project_targets("test" ryml-api-test-python3)
|
c4_set_folder_remote_project_targets("test" ryml-api-test-python3)
|
||||||
function(add_python_test script)
|
function(add_python_test script)
|
||||||
get_filename_component(script_name ${script} NAME_WE)
|
get_filename_component(script_name ${script} NAME_WE)
|
||||||
set(script ${pydir}/ryml/tests/${script})
|
set(script ${pydir}/tests/${script})
|
||||||
set(tn ryml-api-test-python3-${script_name})
|
set(tn ryml-api-test-python3-${script_name})
|
||||||
set(cmd python ${script})
|
set(cmd python ${script})
|
||||||
add_custom_target(${tn}
|
add_custom_target(${tn}
|
||||||
@@ -145,6 +145,7 @@ if(RYML_BUILD_API_PYTHON)
|
|||||||
add_test(NAME ${tn}-run
|
add_test(NAME ${tn}-run
|
||||||
COMMAND ${cmd})
|
COMMAND ${cmd})
|
||||||
endfunction()
|
endfunction()
|
||||||
|
add_python_test(test_readme.py)
|
||||||
add_python_test(test_parse.py)
|
add_python_test(test_parse.py)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
import ryml
|
import ryml
|
||||||
from ryml.ryml import _same_ptr, _same_mem
|
try:
|
||||||
|
from ryml.ryml import _same_ptr, _same_mem
|
||||||
|
except:
|
||||||
|
from ryml import _same_ptr, _same_mem
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -30,3 +30,4 @@
|
|||||||
```
|
```
|
||||||
- [PR#501](https://github.com/biojppm/rapidyaml/pull/501): fix missing tag in `- !!seq []`.
|
- [PR#501](https://github.com/biojppm/rapidyaml/pull/501): fix missing tag in `- !!seq []`.
|
||||||
- [PR#508](https://github.com/biojppm/rapidyaml/pull/508): fix build with cmake 4.
|
- [PR#508](https://github.com/biojppm/rapidyaml/pull/508): fix build with cmake 4.
|
||||||
|
- [PR#517](https://github.com/biojppm/rapidyaml/pull/517): fix python wheels for windows.
|
||||||
|
|||||||
103
setup.py
103
setup.py
@@ -8,7 +8,7 @@ import sys
|
|||||||
import shlex
|
import shlex
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from distutils import log
|
from distutils import log as log_
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
from cmake_build_extension import BuildExtension, CMakeExtension
|
from cmake_build_extension import BuildExtension, CMakeExtension
|
||||||
|
|
||||||
@@ -18,21 +18,38 @@ TOP_DIR = (Path(__file__).parent).resolve()
|
|||||||
PYTHON_DIR = "api/python"
|
PYTHON_DIR = "api/python"
|
||||||
|
|
||||||
|
|
||||||
|
def log(msg, *args, **kwargs):
|
||||||
|
log_.info("rapidyaml: " + msg, *args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
def get_readme_for_python():
|
def get_readme_for_python():
|
||||||
with open(TOP_DIR / "README.md", "r", encoding="utf8") as fh:
|
with open(TOP_DIR / "README.md", "r", encoding="utf8") as fh:
|
||||||
marker = "<!-- endpythonreadme -->" # get everything up to this tag
|
marker = "<!-- endpythonreadme -->" # get everything up to this tag
|
||||||
return fh.read().split(marker)[0]
|
return fh.read().split(marker)[0]
|
||||||
|
|
||||||
|
|
||||||
def get_environment_cmake_flags():
|
def get_cmake_flags_environment():
|
||||||
return shlex.split(os.environ.get("CMAKE_FLAGS", ""))
|
return shlex.split(os.environ.get("CMAKE_FLAGS", ""))
|
||||||
|
|
||||||
|
|
||||||
setup_kw = {}
|
def get_cmake_flags():
|
||||||
|
return [
|
||||||
|
"-DBUILD_SHARED_LIBS:BOOL=ON",
|
||||||
|
"-DRYML_DEV:BOOL=OFF",
|
||||||
|
"-DRYML_BUILD_API:BOOL=ON",
|
||||||
|
"-DRYML_DEFAULT_CALLBACKS:BOOL=ON",
|
||||||
|
"-DRYML_DEFAULT_CALLBACK_USES_EXCEPTIONS:BOOL=ON",
|
||||||
|
# Force cmake to use the Python interpreter we are currently
|
||||||
|
# using to run setup.py
|
||||||
|
"-DPython3_EXECUTABLE:FILEPATH=" + sys.executable,
|
||||||
|
] + get_cmake_flags_environment()
|
||||||
|
|
||||||
# read the module description from the README.md file
|
|
||||||
setup_kw['long_description'] = get_readme_for_python()
|
setup_kw = {
|
||||||
setup_kw['long_description_content_type'] = "text/markdown"
|
# read the module description from the README.md file
|
||||||
|
'long_description': get_readme_for_python(),
|
||||||
|
'long_description_content_type': "text/markdown",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# read the package version when not in a git repository
|
# read the package version when not in a git repository
|
||||||
@@ -48,58 +65,56 @@ else:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
cmake_flags = get_cmake_flags()
|
||||||
|
|
||||||
|
print('Compiling with CMake flags:\n ' + '\n '.join(cmake_flags))
|
||||||
|
|
||||||
# define a CMake package
|
# define a CMake package
|
||||||
cmake_args = dict(
|
cmake_args = dict(
|
||||||
name='ryml.ryml',
|
name='ryml.ryml',
|
||||||
install_prefix='',
|
install_prefix='',
|
||||||
source_dir='',
|
source_dir='',
|
||||||
cmake_component='python',
|
#cmake_component='python',
|
||||||
cmake_configure_options=get_environment_cmake_flags() + [
|
cmake_configure_options=get_cmake_flags(),
|
||||||
"-DRYML_BUILD_API:BOOL=ON",
|
|
||||||
"-DRYML_DEFAULT_CALLBACKS:BOOL=ON",
|
|
||||||
"-DRYML_DEFAULT_CALLBACK_USES_EXCEPTIONS:BOOL=ON",
|
|
||||||
# Force cmake to use the Python interpreter we are currently
|
|
||||||
# using to run setup.py
|
|
||||||
"-DPython3_EXECUTABLE:FILEPATH=" + sys.executable,
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ext = CMakeExtension(**cmake_args)
|
ext = CMakeExtension(**cmake_args)
|
||||||
log.info("Using standard CMakeExtension")
|
log("Using standard CMakeExtension")
|
||||||
except TypeError:
|
except TypeError:
|
||||||
log.info("Using custom CMakeExtension")
|
log("Using custom CMakeExtension")
|
||||||
# If the CMakeExtension doesn't support `cmake_component` then we
|
# If the CMakeExtension doesn't support `cmake_component` then we
|
||||||
# have to do some manual cleanup.
|
# have to do some manual cleanup.
|
||||||
del cmake_args['cmake_component']
|
del cmake_args['cmake_component']
|
||||||
ext = CMakeExtension(**cmake_args)
|
ext = CMakeExtension(**cmake_args)
|
||||||
def _cleanup(path, mandatory):
|
|
||||||
if mandatory:
|
|
||||||
assert path.exists(), path
|
|
||||||
elif not path.exists():
|
|
||||||
return
|
|
||||||
log.info("Removing everything under: %s", path)
|
|
||||||
shutil.rmtree(path)
|
|
||||||
_BuildExtension = BuildExtension
|
|
||||||
class BuildExtension(_BuildExtension):
|
|
||||||
def build_extension(self, ext):
|
|
||||||
_BuildExtension.build_extension(self, ext)
|
|
||||||
ext_dir = Path(self.get_ext_fullpath(ext.name)).parent.absolute()
|
|
||||||
cmake_install_prefix = ext_dir / ext.install_prefix
|
|
||||||
assert cmake_install_prefix.exists(), cmake_install_prefix
|
|
||||||
try:
|
|
||||||
_cleanup(cmake_install_prefix / "lib", mandatory=True)
|
|
||||||
_cleanup(cmake_install_prefix / "include", mandatory=True)
|
|
||||||
# Windows only
|
|
||||||
_cleanup(cmake_install_prefix / "cmake", mandatory=False)
|
|
||||||
except:
|
|
||||||
log.info('Found following installed files:')
|
|
||||||
for f in cmake_install_prefix.rglob("*"):
|
|
||||||
log.info(' - %s', f)
|
|
||||||
raise
|
|
||||||
|
|
||||||
log.info('Compiling with CMake cfg:\n' + '\n'.join(ext.cmake_configure_options))
|
|
||||||
|
# use a custom BuildExtension to ensure extra files are removed
|
||||||
|
class _BuildExtension(BuildExtension):
|
||||||
|
def build_extension(self, ext):
|
||||||
|
BuildExtension.build_extension(self, ext)
|
||||||
|
ext_dir = Path(self.get_ext_fullpath(ext.name)).parent.absolute()
|
||||||
|
cmake_install_prefix = ext_dir / ext.install_prefix
|
||||||
|
assert cmake_install_prefix.exists(), cmake_install_prefix
|
||||||
|
try:
|
||||||
|
def _cleanup(suffix):
|
||||||
|
path = cmake_install_prefix / suffix
|
||||||
|
if path.exists():
|
||||||
|
log("Removing everything under: %s", path)
|
||||||
|
shutil.rmtree(path)
|
||||||
|
else:
|
||||||
|
log("%s not found", path)
|
||||||
|
_cleanup("lib")
|
||||||
|
_cleanup("include")
|
||||||
|
_cleanup("cmake")
|
||||||
|
except:
|
||||||
|
log('Found following installed files:')
|
||||||
|
for f in cmake_install_prefix.rglob("*"):
|
||||||
|
log(' - %s', f)
|
||||||
|
raise
|
||||||
|
|
||||||
|
|
||||||
|
log('Compiling with CMake cfg:\n ' + '\n '.join(ext.cmake_configure_options))
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='rapidyaml',
|
name='rapidyaml',
|
||||||
@@ -110,7 +125,7 @@ setup(
|
|||||||
author="Joao Paulo Magalhaes",
|
author="Joao Paulo Magalhaes",
|
||||||
author_email="dev@jpmag.me",
|
author_email="dev@jpmag.me",
|
||||||
# Package contents control
|
# Package contents control
|
||||||
cmdclass={"build_ext": BuildExtension,},
|
cmdclass={"build_ext": _BuildExtension,},
|
||||||
package_dir={"": PYTHON_DIR},
|
package_dir={"": PYTHON_DIR},
|
||||||
packages=['ryml'],
|
packages=['ryml'],
|
||||||
ext_modules=[ext],
|
ext_modules=[ext],
|
||||||
|
|||||||
Reference in New Issue
Block a user