mirror of
https://github.com/biojppm/rapidyaml.git
synced 2026-01-18 13:31:19 +01:00
[ci] disable creation of python packages for Windows (except 3.6/3.7) and MacOSX
Here's an example log of the problem for Windows: see https://github.com/biojppm/rapidyaml/actions/runs/3686238289/jobs/6238204139 ``` + pip install -v dist/rapidyaml-0.4.1.post139-cp311-cp311-win_amd64.whl Using pip 22.3.1 from C:\hostedtoolcache\windows\Python\3.11.0\x64\Lib\site-packages\pip (python 3.11) Processing d:\a\rapidyaml\rapidyaml\dist\rapidyaml-0.4.1.post139-cp311-cp311-win_amd64.whl Installing collected packages: rapidyaml Successfully installed rapidyaml-0.4.1.post139 + pip show -f rapidyaml Name: rapidyaml Version: 0.4.1.post139 Summary: Rapid YAML - a library to parse and emit YAML, and do it fast Home-page: https://github.com/biojppm/rapidyaml Author: Joao Paulo Magalhaes Author-email: dev@jpmag.me License: MIT Location: C:\hostedtoolcache\windows\Python\3.11.0\x64\Lib\site-packages Requires: Required-by: Files: rapidyaml-0.4.1.post139.dist-info\INSTALLER rapidyaml-0.4.1.post139.dist-info\LICENSE.txt rapidyaml-0.4.1.post139.dist-info\METADATA rapidyaml-0.4.1.post139.dist-info\RECORD rapidyaml-0.4.1.post139.dist-info\REQUESTED rapidyaml-0.4.1.post139.dist-info\WHEEL rapidyaml-0.4.1.post139.dist-info\direct_url.json rapidyaml-0.4.1.post139.dist-info\top_level.txt ryml\__init__.py ryml\__pycache__\__init__.cpython-311.pyc ryml\__pycache__\ryml.cpython-311.pyc ryml\__pycache__\version.cpython-311.pyc ryml\_ryml.pyd ryml\ryml.py ryml\tests\__pycache__\parse_bm.cpython-311.pyc ryml\tests\__pycache__\test_parse.cpython-311.pyc ryml\tests\parse_bm.py ryml\tests\test_parse.py ryml\version.py + python -c 'import ryml' Traceback (most recent call last): File "<string>", line 1, in <module> File "C:\hostedtoolcache\windows\Python\3.11.0\x64\Lib\site-packages\ryml\__init__.py", line 1, in <module> from ryml.ryml import * File "C:\hostedtoolcache\windows\Python\3.11.0\x64\Lib\site-packages\ryml\ryml.py", line 13, in <module> from . import _ryml ImportError: DLL load failed while importing _ryml: The specified module could not be found. Error: Process completed with exit code 1. ```
This commit is contained in:
6
.github/reqs.sh
vendored
6
.github/reqs.sh
vendored
@@ -192,6 +192,7 @@ function _c4_gather_compilers()
|
||||
g++-5 ) _c4_addgcc 5 ;;
|
||||
#g++-4.9 ) _c4_addgcc 4.9 ;; # https://askubuntu.com/questions/1036108/install-gcc-4-9-at-ubuntu-18-04
|
||||
g++-4.8 ) _c4_addgcc 4.8 ;;
|
||||
clang++-14 ) _c4_addclang 14 ;;
|
||||
clang++-13 ) _c4_addclang 13 ;;
|
||||
clang++-12 ) _c4_addclang 12 ;;
|
||||
clang++-11 ) _c4_addclang 11 ;;
|
||||
@@ -204,7 +205,7 @@ function _c4_gather_compilers()
|
||||
clang++-4.0) _c4_addclang 4.0 ;;
|
||||
clang++-3.9) _c4_addclang 3.9 ;;
|
||||
all)
|
||||
all="g++-11 g++-10 g++-9 g++-8 g++-7 g++-6 g++-5 clang++-12 clang++-11 clang++-10 clang++-9 clang++-8 clang++-7 clang++-6.0 clang++-5.0 clang++-4.0 clang++-3.9"
|
||||
all="g++-12 g++-11 g++-10 g++-9 g++-8 g++-7 g++-6 g++-5 clang++-14 clang++-13 clang++-12 clang++-11 clang++-10 clang++-9 clang++-8 clang++-7 clang++-6.0 clang++-5.0 clang++-4.0 clang++-3.9"
|
||||
echo "installing all compilers: $all"
|
||||
for cxx in $all ; do
|
||||
_c4_gather_compilers $cxx
|
||||
@@ -246,9 +247,10 @@ function _c4_addclang()
|
||||
clversion=$1
|
||||
case $clversion in
|
||||
# in 18.04, clang9 and later require PPAs
|
||||
9 | 10 | 11 | 12 | 13)
|
||||
9 | 10 | 11 | 12 | 13 | 14)
|
||||
_add_apt clang-$clversion "deb http://apt.llvm.org/$UBUNTU_RELEASE_NAME/ llvm-toolchain-$UBUNTU_RELEASE_NAME-$clversion main"
|
||||
# libstdc++ is required
|
||||
#_c4_addgcc 12
|
||||
_c4_addgcc 11
|
||||
_c4_addgcc 10
|
||||
_c4_addgcc 9
|
||||
|
||||
95
.github/workflows/release.yml
vendored
95
.github/workflows/release.yml
vendored
@@ -149,7 +149,7 @@ jobs:
|
||||
set -x
|
||||
source vars.sh
|
||||
mkdir -p assets
|
||||
asset_src=`ls -1 ./build/shared64/${PROJ_PFX_TARGET}*-${{matrix.config.sfxg}}`
|
||||
asset_src=`ls -1 ./build/shared64/*-${{matrix.config.sfxg}}`
|
||||
asset_dst=./assets/${PROJ_PKG_NAME}${SRC_VERSION}-${{matrix.config.sfxp}}
|
||||
[ ! -f $asset_src ] && exit 1
|
||||
cp -fav $asset_src $asset_dst
|
||||
@@ -198,40 +198,54 @@ jobs:
|
||||
runs-on: ${{matrix.config.os}}
|
||||
env:
|
||||
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_BUILD: "cp${{matrix.config.cibw_pyv}}-${{matrix.config.cibw_platform}}"
|
||||
CIBW_ARCHS: "${{matrix.config.cibw_arch}}"
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config:
|
||||
- {pythonv: 3.9, cibw_pyv: 39 , cibw_arch: x86_64, cibw_platform: manylinux_x86_64, osname: linux, os: ubuntu-20.04}
|
||||
- {pythonv: 3.9, cibw_pyv: 39 , cibw_arch: i686 , cibw_platform: manylinux_i686 , osname: linux, os: ubuntu-20.04}
|
||||
- {pythonv: 3.8, cibw_pyv: 38 , cibw_arch: x86_64, cibw_platform: manylinux_x86_64, osname: linux, os: ubuntu-20.04}
|
||||
- {pythonv: 3.8, cibw_pyv: 38 , cibw_arch: i686 , cibw_platform: manylinux_i686 , osname: linux, os: ubuntu-20.04}
|
||||
- {pythonv: 3.7, cibw_pyv: 37 , cibw_arch: x86_64, cibw_platform: manylinux_x86_64, osname: linux, os: ubuntu-20.04}
|
||||
- {pythonv: 3.7, cibw_pyv: 37 , cibw_arch: i686 , cibw_platform: manylinux_i686 , osname: linux, os: ubuntu-20.04}
|
||||
# the windows 32bit are disabled because they are causing problems and preventing the release.
|
||||
# the 3-digit versions NEED to be quoted to prevent the version being read as float. (!)
|
||||
- {pythonv: '3.11', cibw_pyv: 311, cibw_arch: x86_64, cibw_platform: manylinux_x86_64, osname: linux, os: ubuntu-20.04}
|
||||
- {pythonv: '3.11', cibw_pyv: 311, cibw_arch: i686 , cibw_platform: manylinux_i686 , osname: linux, os: ubuntu-20.04}
|
||||
- {pythonv: '3.10', cibw_pyv: 310, cibw_arch: x86_64, cibw_platform: manylinux_x86_64, osname: linux, os: ubuntu-20.04}
|
||||
- {pythonv: '3.10', cibw_pyv: 310, cibw_arch: i686 , cibw_platform: manylinux_i686 , osname: linux, os: ubuntu-20.04}
|
||||
- {pythonv: 3.9 , cibw_pyv: 39 , cibw_arch: x86_64, cibw_platform: manylinux_x86_64, osname: linux, os: ubuntu-20.04}
|
||||
- {pythonv: 3.9 , cibw_pyv: 39 , cibw_arch: i686 , cibw_platform: manylinux_i686 , osname: linux, os: ubuntu-20.04}
|
||||
- {pythonv: 3.8 , cibw_pyv: 38 , cibw_arch: x86_64, cibw_platform: manylinux_x86_64, osname: linux, os: ubuntu-20.04}
|
||||
- {pythonv: 3.8 , cibw_pyv: 38 , cibw_arch: i686 , cibw_platform: manylinux_i686 , osname: linux, os: ubuntu-20.04}
|
||||
- {pythonv: 3.7 , cibw_pyv: 37 , cibw_arch: x86_64, cibw_platform: manylinux_x86_64, osname: linux, os: ubuntu-20.04}
|
||||
- {pythonv: 3.7 , cibw_pyv: 37 , cibw_arch: i686 , cibw_platform: manylinux_i686 , osname: linux, os: ubuntu-20.04}
|
||||
- {pythonv: 3.6 , cibw_pyv: 36 , cibw_arch: x86_64, cibw_platform: manylinux_x86_64, osname: linux, os: ubuntu-20.04}
|
||||
- {pythonv: 3.6 , cibw_pyv: 36 , cibw_arch: i686 , cibw_platform: manylinux_i686 , osname: linux, os: ubuntu-20.04}
|
||||
# the windows builds are disabled because they are causing problems and preventing the release.
|
||||
# the problems are related to CMakeExtension forcing the use of Ninja
|
||||
# which does not play well with the -G 'Visual Studio...' option used below.
|
||||
# fixing this looks like it will be time-intensive.
|
||||
#- {pythonv: 3.9, cibw_pyv: 39 , cibw_arch: AMD64 , cibw_platform: win_amd64 , osname: win , os: windows-2019, cxx: vs2019, cmakeflags: '-G "Visual Studio 16 2019" -A x64'}
|
||||
#- {pythonv: 3.9, cibw_pyv: 39 , cibw_arch: x86 , cibw_platform: win32 , osname: win , os: windows-2019, cxx: vs2019, cmakeflags: '-G "Visual Studio 16 2019" -A Win32'}
|
||||
#- {pythonv: 3.8, cibw_pyv: 38 , cibw_arch: AMD64 , cibw_platform: win_amd64 , osname: win , os: windows-2019, cxx: vs2019, cmakeflags: '-G "Visual Studio 16 2019" -A x64'}
|
||||
#- {pythonv: 3.8, cibw_pyv: 38 , cibw_arch: x86 , cibw_platform: win32 , osname: win , os: windows-2019, cxx: vs2019, cmakeflags: '-G "Visual Studio 16 2019" -A Win32'}
|
||||
#- {pythonv: 3.7, cibw_pyv: 37 , cibw_arch: AMD64 , cibw_platform: win_amd64 , osname: win , os: windows-2019, cxx: vs2019, cmakeflags: '-G "Visual Studio 16 2019" -A x64'}
|
||||
#- {pythonv: 3.7, cibw_pyv: 37 , cibw_arch: x86 , cibw_platform: win32 , osname: win , os: windows-2019, cxx: vs2019, cmakeflags: '-G "Visual Studio 16 2019" -A Win32'}
|
||||
# TODO: macos
|
||||
#- {pythonv: 3.9 , cxx: xcode, os: macos-10.15}
|
||||
#- {pythonv: 3.9 , cxx: xcode, os: macos-10.15}
|
||||
#- {pythonv: 3.8 , cxx: xcode, os: macos-10.15}
|
||||
#- {pythonv: 3.8 , cxx: xcode, os: macos-10.15}
|
||||
#- {pythonv: 3.7 , cxx: xcode, os: macos-10.15}
|
||||
#- {pythonv: 3.7 , cxx: xcode, os: macos-10.15}
|
||||
#- {pythonv: '3.11', cibw_pyv: 311, cibw_arch: AMD64 , cibw_platform: win_amd64, osname: win , os: windows-2019, cxx: vs2019} #, cmakeflags: '-G "Visual Studio 16 2019" -A x64'}
|
||||
#- {pythonv: '3.11', cibw_pyv: 311, cibw_arch: x86 , cibw_platform: win32 , osname: win , os: windows-2019, cxx: vs2019} #, cmakeflags: '-G "Visual Studio 16 2019" -A Win32'}
|
||||
#- {pythonv: '3.10', cibw_pyv: 310, cibw_arch: AMD64 , cibw_platform: win_amd64, osname: win , os: windows-2019, cxx: vs2019} #, cmakeflags: '-G "Visual Studio 16 2019" -A x64'}
|
||||
#- {pythonv: '3.10', cibw_pyv: 310, cibw_arch: x86 , cibw_platform: win32 , osname: win , os: windows-2019, cxx: vs2019} #, cmakeflags: '-G "Visual Studio 16 2019" -A Win32'}
|
||||
#- {pythonv: 3.9 , cibw_pyv: 39 , cibw_arch: AMD64 , cibw_platform: win_amd64, osname: win , os: windows-2019, cxx: vs2019} #, cmakeflags: '-G "Visual Studio 16 2019" -A x64'}
|
||||
#- {pythonv: 3.9 , cibw_pyv: 39 , cibw_arch: x86 , cibw_platform: win32 , osname: win , os: windows-2019, cxx: vs2019} #, cmakeflags: '-G "Visual Studio 16 2019" -A Win32'}
|
||||
#- {pythonv: 3.8 , cibw_pyv: 38 , cibw_arch: AMD64 , cibw_platform: win_amd64, osname: win , os: windows-2019, cxx: vs2019} #, cmakeflags: '-G "Visual Studio 16 2019" -A x64'}
|
||||
#- {pythonv: 3.8 , cibw_pyv: 38 , cibw_arch: x86 , cibw_platform: win32 , osname: win , os: windows-2019, cxx: vs2019} #, cmakeflags: '-G "Visual Studio 16 2019" -A Win32'}
|
||||
- {pythonv: 3.7 , cibw_pyv: 37 , cibw_arch: AMD64 , cibw_platform: win_amd64, osname: win , os: windows-2019, cxx: vs2019} #, cmakeflags: '-G "Visual Studio 16 2019" -A x64'}
|
||||
#- {pythonv: 3.7 , cibw_pyv: 37 , cibw_arch: x86 , cibw_platform: win32 , osname: win , os: windows-2019, cxx: vs2019} #, cmakeflags: '-G "Visual Studio 16 2019" -A Win32'}
|
||||
- {pythonv: 3.6 , cibw_pyv: 36 , cibw_arch: AMD64 , cibw_platform: win_amd64, osname: win , os: windows-2019, cxx: vs2019} #, cmakeflags: '-G "Visual Studio 16 2019" -A x64'}
|
||||
#- {pythonv: 3.6 , cibw_pyv: 36 , cibw_arch: x86 , cibw_platform: win32 , osname: win , os: windows-2019, cxx: vs2019} #, cmakeflags: '-G "Visual Studio 16 2019" -A Win32'}
|
||||
## macosx builds are generating a SIGSEGV when importing. (!)
|
||||
## https://github.com/biojppm/rapidyaml/actions/runs/3062528713/jobs/4943611397#step:7:269
|
||||
#- {pythonv: '3.11', cibw_pyv: 311, cibw_arch: x86_64, cibw_platform: macosx_x86_64, osname: macos, os: macos-10.15}
|
||||
#- {pythonv: '3.10', cibw_pyv: 310, cibw_arch: x86_64, cibw_platform: macosx_x86_64, osname: macos, os: macos-10.15}
|
||||
#- {pythonv: 3.9 , cibw_pyv: 39 , cibw_arch: x86_64, cibw_platform: macosx_x86_64, osname: macos, os: macos-10.15}
|
||||
#- {pythonv: 3.8 , cibw_pyv: 38 , cibw_arch: x86_64, cibw_platform: macosx_x86_64, osname: macos, os: macos-10.15}
|
||||
#- {pythonv: 3.7 , cibw_pyv: 37 , cibw_arch: x86_64, cibw_platform: macosx_x86_64, osname: macos, os: macos-10.15}
|
||||
#- {pythonv: 3.6 , cibw_pyv: 36 , cibw_arch: x86_64, cibw_platform: macosx_x86_64, osname: macos, os: macos-10.15}
|
||||
steps:
|
||||
# use fetch-depth to ensure all tags are fetched
|
||||
- {name: checkout, uses: actions/checkout@v3, with: {submodules: recursive, fetch-depth: 0}}
|
||||
- name: create wheel
|
||||
uses: joerick/cibuildwheel@v2.1.1
|
||||
uses: joerick/cibuildwheel@v2.9.0
|
||||
- name: rename wheelhouse -> dist
|
||||
run: |
|
||||
mv -fv wheelhouse dist
|
||||
@@ -243,24 +257,27 @@ jobs:
|
||||
- name: install python ${{matrix.config.pythonv}}
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{matrix.config.pythonv}}
|
||||
python-version: '${{matrix.config.pythonv}}'
|
||||
- name: test with python ${{matrix.config.pythonv}}
|
||||
run: |
|
||||
set -x
|
||||
# do not run the tests in 32 bit
|
||||
arch=${{matrix.config.cibw_arch}}
|
||||
if [ "$arch" == "i686" ] || [ "$arch" == "x86" ] ; then
|
||||
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 ; dir(ryml) ; tree = ryml.parse_in_arena(b"{foo: bar}") ; assert tree.key(1) == b"foo" ; assert tree.val(1) == b"bar"'
|
||||
python -m nose -v api/python/ryml/tests
|
||||
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
|
||||
|
||||
@@ -290,16 +307,6 @@ jobs:
|
||||
ls -lFhp assets/
|
||||
ls -lFhp dist/
|
||||
#
|
||||
# PyPI (test)
|
||||
- name: Publish python packages to test PyPI
|
||||
uses: pypa/gh-action-pypi-publish@v1.4.2
|
||||
with:
|
||||
repository_url: https://test.pypi.org/legacy/
|
||||
user: __token__
|
||||
password: ${{secrets.PYPI_TOKEN_TEST}}
|
||||
verbose: true
|
||||
skip_existing: true
|
||||
#
|
||||
# Github
|
||||
- name: Restore vars.sh
|
||||
if: contains(github.ref, 'tags/v')
|
||||
@@ -339,6 +346,16 @@ jobs:
|
||||
release_id: ${{steps.create_release.outputs.id}}
|
||||
assets_path: ./assets/
|
||||
#
|
||||
# PyPI (test)
|
||||
- name: Publish python packages to test PyPI
|
||||
uses: pypa/gh-action-pypi-publish@v1.4.2
|
||||
with:
|
||||
repository_url: https://test.pypi.org/legacy/
|
||||
user: __token__
|
||||
password: ${{secrets.PYPI_TOKEN_TEST}}
|
||||
verbose: true
|
||||
skip_existing: true
|
||||
#
|
||||
# PyPI (production)
|
||||
- name: Publish python packages to production PyPI
|
||||
if: contains(github.ref, 'tags/v')
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -41,6 +41,7 @@ compile_commands.json
|
||||
.eggs/
|
||||
dist/
|
||||
rapidyaml.egg-info/
|
||||
wheelhouse/
|
||||
|
||||
# continuous integration files
|
||||
.ci/.vagrant
|
||||
|
||||
@@ -5,9 +5,15 @@ option(RYML_API_BENCHMARKS "Enable API tests" ${RYML_BUILD_BENCHMARKS})
|
||||
c4_log("enabling API")
|
||||
|
||||
cmake_policy(PUSH)
|
||||
cmake_policy(SET CMP0078 NEW) # https://cmake.org/cmake/help/v3.14/policy/CMP0078.html
|
||||
cmake_policy(SET CMP0086 NEW) # https://cmake.org/cmake/help/v3.14/policy/CMP0086.html
|
||||
cmake_policy(SET CMP0094 NEW) # https://cmake.org/cmake/help/v3.14/policy/CMP0094.html
|
||||
# UseSWIG generates standard target names.
|
||||
# https://cmake.org/cmake/help/latest/policy/CMP0078.html
|
||||
cmake_policy(SET CMP0078 NEW)
|
||||
# UseSWIG honors SWIG_MODULE_NAME via -module flag.
|
||||
# https://cmake.org/cmake/help/latest/policy/CMP0086.html
|
||||
cmake_policy(SET CMP0086 NEW)
|
||||
# Modules FindPython3, FindPython2 and FindPython use LOCATION for lookup strategy.
|
||||
# https://cmake.org/cmake/help/latest/policy/CMP0094.html
|
||||
cmake_policy(SET CMP0094 NEW)
|
||||
|
||||
find_package(SWIG REQUIRED)
|
||||
c4_log("found swig ${SWIG_VERSION}: ${SWIG_EXECUTABLE}")
|
||||
@@ -53,10 +59,19 @@ endif()
|
||||
if(RYML_BUILD_API_PYTHON)
|
||||
c4_log("enabling python3 API")
|
||||
set(Python3_FIND_VIRTUALENV "FIRST")
|
||||
# use Development.Module to ensure this works with cibuildwheel:
|
||||
# https://github.com/pypa/cibuildwheel/issues/639
|
||||
find_package(Python3 COMPONENTS Interpreter Development.Module REQUIRED)
|
||||
c4_log("found python ${Python3_VERSION}: ${Python3_EXECUTABLE}")
|
||||
if(APPLE)
|
||||
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
|
||||
else()
|
||||
# use Development.Module to ensure this works with cibuildwheel:
|
||||
# https://github.com/pypa/cibuildwheel/issues/639
|
||||
find_package(Python3 COMPONENTS Interpreter Development.Module REQUIRED)
|
||||
endif()
|
||||
c4_log("found python:
|
||||
ver=${Python3_VERSION}
|
||||
exe=${Python3_EXECUTABLE}
|
||||
lib=${Python3_LIBRARIES}
|
||||
inc=${Python3_INCLUDE_DIRS}
|
||||
")
|
||||
#
|
||||
set(t ryml-api-python3) # the target name
|
||||
set(g ${CMAKE_CURRENT_BINARY_DIR}/src/python3) # where to put c++ generated srcs
|
||||
|
||||
@@ -10,24 +10,29 @@ ifeq ($(OS),Windows_NT)
|
||||
ACTIVATE_SCRIPT := venv/Scripts/activate
|
||||
endif
|
||||
|
||||
# How to invoke python
|
||||
PYTHON := python
|
||||
# How to invoke pytest
|
||||
PYTEST := $(PYTHON) -m pytest -vvv
|
||||
|
||||
ACTIVATE=[[ -e $(ACTIVATE_SCRIPT) ]] && source $(ACTIVATE_SCRIPT);
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -rf dist *.egg-info
|
||||
rm -rf ../../build ../../.egg*
|
||||
rm -rf ryml/*.so ryml/ryml.py ryml/include ryml/lib
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
.PHONY: venv-clean
|
||||
venv-clean:
|
||||
rm -rf venv
|
||||
|
||||
.PHONY: venv-clean
|
||||
|
||||
$(ACTIVATE_SCRIPT): requirements.txt Makefile
|
||||
make venv
|
||||
@touch $(ACTIVATE_SCRIPT)
|
||||
|
||||
.PHONY: venv
|
||||
venv:
|
||||
virtualenv --python=python3 --always-copy venv
|
||||
# Packaging tooling.
|
||||
@@ -35,65 +40,55 @@ venv:
|
||||
# Setup requirements.
|
||||
${ACTIVATE} pip install -v -r requirements.txt
|
||||
${ACTIVATE} pip install -v -e ../..
|
||||
@${ACTIVATE} python -c "from ryml.version import version as v; print('Installed version:', v)"
|
||||
|
||||
.PHONY: venv
|
||||
|
||||
build-sdist: | $(ACTIVATE_SCRIPT)
|
||||
${ACTIVATE} (cd ../..; python -m build --sdist --outdir $(PWD)/dist)
|
||||
@${ACTIVATE} $(PYTHON) -c "from ryml.version import version as v; print('Installed version:', v)"
|
||||
|
||||
.PHONY: build-sdist
|
||||
build-sdist: | $(ACTIVATE_SCRIPT)
|
||||
${ACTIVATE} (cd ../..; $(PYTHON) -m build --sdist --outdir $(PWD)/dist)
|
||||
|
||||
|
||||
.PHONY: build-wheel
|
||||
build-wheel: | $(ACTIVATE_SCRIPT)
|
||||
rm -rf dist
|
||||
$(MAKE) build-sdist
|
||||
@ls -l dist/*.tar.gz
|
||||
${ACTIVATE} pip wheel -v dist/*.tar.gz --wheel-dir $(PWD)/dist
|
||||
|
||||
.PHONY: build-wheel
|
||||
|
||||
.PHONY: build
|
||||
build:
|
||||
rm -rf build dist
|
||||
$(MAKE) build-sdist
|
||||
$(MAKE) build-wheel
|
||||
|
||||
.PHONY: build
|
||||
|
||||
# PYPI_TEST = --repository-url https://test.pypi.org/legacy/
|
||||
PYPI_TEST = --repository testpypi
|
||||
|
||||
.PHONY: upload-test
|
||||
upload-test: | $(ACTIVATE_SCRIPT)
|
||||
make clean
|
||||
make build-sdist
|
||||
${ACTIVATE} twine upload ${PYPI_TEST} dist/*
|
||||
|
||||
.PHONY: upload-test
|
||||
|
||||
.PHONY: upload
|
||||
upload: | $(ACTIVATE_SCRIPT)
|
||||
make clean
|
||||
make build-sdist
|
||||
${ACTIVATE} twine upload --verbose dist/*
|
||||
|
||||
.PHONY: upload
|
||||
|
||||
.PHONY: check
|
||||
check: | $(ACTIVATE_SCRIPT)
|
||||
make clean
|
||||
make build-wheel
|
||||
${ACTIVATE} twine check dist/*.whl
|
||||
|
||||
.PHONY: check
|
||||
|
||||
install: | $(ACTIVATE_SCRIPT)
|
||||
${ACTIVATE} python setup.py install
|
||||
|
||||
.PHONY: install
|
||||
|
||||
test: | $(ACTIVATE_SCRIPT)
|
||||
${ACTIVATE} python -m nose ryml/tests
|
||||
install: | $(ACTIVATE_SCRIPT)
|
||||
${ACTIVATE} $(PYTHON) setup.py install
|
||||
|
||||
.PHONY: test
|
||||
|
||||
version: | $(ACTIVATE_SCRIPT)
|
||||
${ACTIVATE} python setup.py --version
|
||||
test: | $(ACTIVATE_SCRIPT)
|
||||
${ACTIVATE} $(PYTEST) tests
|
||||
|
||||
.PHONY: version
|
||||
version: | $(ACTIVATE_SCRIPT)
|
||||
${ACTIVATE} $(PYTHON) setup.py --version
|
||||
|
||||
@@ -2,4 +2,4 @@ ruamel.yaml
|
||||
ninja
|
||||
pyyaml
|
||||
prettytable
|
||||
nose
|
||||
pytest
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
from ryml.ryml import *
|
||||
from .version import *
|
||||
|
||||
@@ -106,7 +106,7 @@ def _addseq(t, node, k=None):
|
||||
return m
|
||||
|
||||
|
||||
def _addleaf(t, node, k, v=None):
|
||||
def _addval(t, node, k, v=None):
|
||||
ch = t.append_child(node)
|
||||
if v is None:
|
||||
t.to_val(ch, k)
|
||||
@@ -121,32 +121,32 @@ def _addleaf(t, node, k, v=None):
|
||||
def check_tree_mod(ut, t):
|
||||
# some convenient shorthands
|
||||
eq = ut.assertEqual
|
||||
def _leaf(node, k, v=None):
|
||||
ch = _addleaf(t, node, k, v)
|
||||
def _addval_and_check(node, k, v=None):
|
||||
ch = _addval(t, node, k, v)
|
||||
pos = t.child_pos(node, ch)
|
||||
eq(t.child(node, pos), ch)
|
||||
if v is not None:
|
||||
eq(t.find_child(node, k), ch)
|
||||
eq(t.child(node, pos), t.find_child(node, k))
|
||||
return ch
|
||||
def _seq(node, k):
|
||||
def _addseq_and_check(node, k):
|
||||
ch = _addseq(t, node, k)
|
||||
eq(t.find_child(node, k), ch)
|
||||
return ch
|
||||
def _map(node, k):
|
||||
def _addmap_and_check(node, k):
|
||||
ch = _addmap(t, node, k)
|
||||
eq(t.find_child(node, k), ch)
|
||||
return ch
|
||||
m = _map(t.root_id(), "check_tree_mod_map")
|
||||
_leaf(m, "k1", "v1")
|
||||
_leaf(m, "k2", "v2")
|
||||
_leaf(m, "k3", "v3")
|
||||
m = _addmap_and_check(t.root_id(), "check_tree_mod_map")
|
||||
_addval_and_check(m, "k1", "v1")
|
||||
_addval_and_check(m, "k2", "v2")
|
||||
_addval_and_check(m, "k3", "v3")
|
||||
eq(t.num_children(m), 3)
|
||||
eq(t.num_siblings(t.first_child(m)), 3)
|
||||
s = _seq(t.root_id(), "check_tree_mod_seq")
|
||||
_leaf(s, "v1")
|
||||
_leaf(s, "v2")
|
||||
_leaf(s, "v3")
|
||||
s = _addseq_and_check(t.root_id(), "check_tree_mod_seq")
|
||||
_addval_and_check(s, "v1")
|
||||
_addval_and_check(s, "v2")
|
||||
_addval_and_check(s, "v3")
|
||||
eq(t.num_children(s), 3)
|
||||
eq(t.num_siblings(t.first_child(m)), 3)
|
||||
|
||||
@@ -154,7 +154,7 @@ def check_tree_mod(ut, t):
|
||||
# -----------------------------------------------------------------------------
|
||||
# -----------------------------------------------------------------------------
|
||||
# -----------------------------------------------------------------------------
|
||||
class SimpleHardcoded:
|
||||
class SimpleTestCase:
|
||||
|
||||
yaml = "{'HELLO': a, foo: \"b\", bar: c, baz: d, seq: [0, 1, 2, 3]}"
|
||||
|
||||
@@ -353,92 +353,97 @@ class SimpleHardcoded:
|
||||
# -----------------------------------------------------------------------------
|
||||
# -----------------------------------------------------------------------------
|
||||
# -----------------------------------------------------------------------------
|
||||
class _TestBase(unittest.TestCase):
|
||||
class TestRunner(unittest.TestCase):
|
||||
|
||||
def _setUp(self, case=None):
|
||||
def setUp(self):
|
||||
self._setUp(SimpleTestCase())
|
||||
|
||||
# allow creating this class with different cases
|
||||
# if they are added
|
||||
def _setUp(self, case):
|
||||
self.case = case
|
||||
self.src_as_str = str(case.yaml)
|
||||
self.src_as_bytes = bytes(case.yaml, "utf8")
|
||||
self.src_as_bytearray = bytearray(case.yaml, "utf8")
|
||||
|
||||
# ----------------------------------------------------------
|
||||
def _test11_str__ro(self): # cannot read string buffers (or can we?)
|
||||
def test11_str__arena(self): # cannot read string buffers (or can we?)
|
||||
tree = ryml.parse_in_arena(self.src_as_str)
|
||||
self.case.check(self, tree)
|
||||
|
||||
def _test12_str__ro__reuse_tree(self): # cannot read string buffers (or can we?)
|
||||
def test12_str__arena__reuse_tree(self): # cannot read string buffers (or can we?)
|
||||
t = ryml.Tree()
|
||||
ryml.parse_in_arena(self.src_as_str, tree=t)
|
||||
self.case.check(self, t)
|
||||
|
||||
def _test13_str__rw(self): # cannot mutate string buffers (or can we?)
|
||||
def test13_str__inplace(self): # cannot mutate string buffers (or can we?)
|
||||
with self.assertRaises(TypeError) as context:
|
||||
ryml.parse_in_place(self.src_as_str)
|
||||
self.assertTrue(type(context.exception), TypeError)
|
||||
|
||||
# ----------------------------------------------------------
|
||||
def _test21_bytes__ro(self):
|
||||
def test21_bytes__arena(self):
|
||||
tree = ryml.parse_in_arena(self.src_as_bytes)
|
||||
self.case.check(self, tree)
|
||||
|
||||
def _test22_bytes__ro__reuse_tree(self):
|
||||
def test22_bytes__arena__reuse_tree(self):
|
||||
t = ryml.Tree()
|
||||
r = ryml.parse_in_arena(self.src_as_bytes, tree=t)
|
||||
self.assertTrue(r is t)
|
||||
self.case.check(self, t)
|
||||
|
||||
def _test23_bytes__rw(self): # cannot mutate bytes buffers
|
||||
def test23_bytes__inplace(self): # cannot mutate bytes buffers
|
||||
with self.assertRaises(TypeError) as context:
|
||||
ryml.parse_in_place(self.src_as_bytes)
|
||||
self.assertTrue(type(context.exception), TypeError)
|
||||
|
||||
# ----------------------------------------------------------
|
||||
def _test31_bytearray__ro(self):
|
||||
def test31_bytearray__arena(self):
|
||||
tree = ryml.parse_in_arena(self.src_as_bytearray)
|
||||
self.case.check(self, tree)
|
||||
|
||||
def _test32_bytearray__ro__reuse_tree(self):
|
||||
def test32_bytearray__arena__reuse_tree(self):
|
||||
t = ryml.Tree()
|
||||
r = ryml.parse_in_arena(self.src_as_bytearray, tree=t)
|
||||
self.assertTrue(r is t)
|
||||
self.case.check(self, t)
|
||||
|
||||
def _test33_bytearray__rw(self): # bytearray buffers are mutable
|
||||
def test33_bytearray__inplace(self): # bytearray buffers are mutable
|
||||
tree = ryml.parse_in_place(self.src_as_bytearray)
|
||||
self.case.check(self, tree)
|
||||
|
||||
def _test34_bytearray__rw__reuse_tree(self): # bytearray buffers are mutable
|
||||
def test34_bytearray__inplace__reuse_tree(self): # bytearray buffers are mutable
|
||||
t = ryml.Tree()
|
||||
r = ryml.parse_in_place(self.src_as_bytearray, tree=t)
|
||||
self.assertTrue(r is t)
|
||||
self.case.check(self, t)
|
||||
|
||||
# ----------------------------------------------------------
|
||||
def _test41_emit_yaml(self):
|
||||
def test41_emit_yaml(self):
|
||||
tree = ryml.parse_in_arena(self.src_as_bytearray)
|
||||
yaml = ryml.emit_yaml(tree)
|
||||
output_tree = ryml.parse_in_arena(yaml)
|
||||
self.case.check(self, output_tree)
|
||||
|
||||
def _test41_emit_json(self):
|
||||
def test41_emit_json(self):
|
||||
tree = ryml.parse_in_arena(self.src_as_bytearray)
|
||||
json = ryml.emit_json(tree)
|
||||
output_tree = ryml.parse_in_arena(json)
|
||||
self.case.check(self, output_tree, is_json=True)
|
||||
|
||||
def _test42_compute_emit_yaml_length(self):
|
||||
def test42_compute_emit_yaml_length(self):
|
||||
tree = ryml.parse_in_arena(self.src_as_bytearray)
|
||||
yaml = ryml.emit_yaml(tree)
|
||||
length = ryml.compute_emit_yaml_length(tree)
|
||||
self.assertEqual(len(yaml), length)
|
||||
|
||||
def _test42_compute_emit_json_length(self):
|
||||
def test42_compute_emit_json_length(self):
|
||||
tree = ryml.parse_in_arena(self.src_as_bytearray)
|
||||
json = ryml.emit_json(tree)
|
||||
length = ryml.compute_emit_json_length(tree)
|
||||
self.assertEqual(len(json), length)
|
||||
|
||||
def _test43_emit_yaml_in_place(self):
|
||||
def test43_emit_yaml_inplace(self):
|
||||
tree = ryml.parse_in_arena(self.src_as_bytearray)
|
||||
yaml = ryml.emit_yaml(tree)
|
||||
length = ryml.compute_emit_yaml_length(tree)
|
||||
@@ -449,7 +454,7 @@ class _TestBase(unittest.TestCase):
|
||||
self.assertTrue(s.tobytes().decode('utf-8') == yaml)
|
||||
self.assertTrue(buf.decode('utf-8') == yaml)
|
||||
|
||||
def _test43_emit_json_in_place(self):
|
||||
def test43_emit_json_inplace(self):
|
||||
tree = ryml.parse_in_arena(self.src_as_bytearray)
|
||||
json = ryml.emit_json(tree)
|
||||
length = ryml.compute_emit_json_length(tree)
|
||||
@@ -460,14 +465,14 @@ class _TestBase(unittest.TestCase):
|
||||
self.assertTrue(s.tobytes().decode('utf-8') == json)
|
||||
self.assertTrue(buf.decode('utf-8') == json)
|
||||
|
||||
def _test44_emit_yaml_short_buf(self):
|
||||
def test44_emit_yaml_short_buf(self):
|
||||
tree = ryml.parse_in_arena(self.src_as_bytearray)
|
||||
length = ryml.compute_emit_yaml_length(tree)
|
||||
buf = bytearray(length-1)
|
||||
with self.assertRaises(IndexError):
|
||||
ryml.emit_yaml_in_place(tree, buf)
|
||||
|
||||
def _test44_emit_json_short_buf(self):
|
||||
def test44_emit_json_short_buf(self):
|
||||
tree = ryml.parse_in_arena(self.src_as_bytearray)
|
||||
length = ryml.compute_emit_json_length(tree)
|
||||
buf = bytearray(length-1)
|
||||
@@ -475,72 +480,6 @@ class _TestBase(unittest.TestCase):
|
||||
ryml.emit_json_in_place(tree, buf)
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# -----------------------------------------------------------------------------
|
||||
# -----------------------------------------------------------------------------
|
||||
class TestSimpleHardCoded(_TestBase):
|
||||
|
||||
def setUp(self):
|
||||
_TestBase._setUp(self, SimpleHardcoded())
|
||||
|
||||
# ----------------------------------------------------------
|
||||
def test11_str__ro(self):
|
||||
super()._test11_str__ro()
|
||||
|
||||
def test12_str__ro__reuse_tree(self):
|
||||
self._test12_str__ro__reuse_tree()
|
||||
|
||||
def test13_str__rw(self):
|
||||
self._test13_str__rw()
|
||||
|
||||
# ----------------------------------------------------------
|
||||
def test21_bytes__ro(self):
|
||||
self._test21_bytes__ro()
|
||||
|
||||
def test22_bytes__ro__reuse_tree(self):
|
||||
self._test22_bytes__ro__reuse_tree()
|
||||
|
||||
def test23_bytes__rw(self):
|
||||
self._test23_bytes__rw()
|
||||
|
||||
# ----------------------------------------------------------
|
||||
def test31_bytearray__ro(self):
|
||||
self._test31_bytearray__ro()
|
||||
|
||||
def test32_bytearray__ro__reuse_tree(self):
|
||||
self._test32_bytearray__ro__reuse_tree()
|
||||
|
||||
def test33_bytearray__rw(self):
|
||||
self._test33_bytearray__rw()
|
||||
|
||||
def test34_bytearray__rw__reuse_tree(self):
|
||||
self._test34_bytearray__rw__reuse_tree()
|
||||
|
||||
# ----------------------------------------------------------
|
||||
def test41_emit_yaml(self):
|
||||
self._test41_emit_yaml()
|
||||
|
||||
def test41_emit_json(self):
|
||||
self._test41_emit_json()
|
||||
|
||||
def test42_compute_emit_yaml_length(self):
|
||||
self._test42_compute_emit_yaml_length()
|
||||
|
||||
def test42_compute_emit_json_length(self):
|
||||
self._test42_compute_emit_json_length()
|
||||
|
||||
def test43_emit_yaml_in_place(self):
|
||||
self._test43_emit_yaml_in_place()
|
||||
|
||||
def test43_emit_json_in_place(self):
|
||||
self._test43_emit_json_in_place()
|
||||
|
||||
def test44_emit_yaml_short_buf(self):
|
||||
self._test44_emit_yaml_short_buf()
|
||||
|
||||
def test44_emit_json_short_buf(self):
|
||||
self._test44_emit_json_short_buf()
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# -----------------------------------------------------------------------------
|
||||
@@ -469,7 +469,6 @@ public:
|
||||
bool has_children(size_t node) const;
|
||||
bool has_sibling(size_t node, c4::csubstr key) const;
|
||||
//bool has_sibling(size_t node, size_t sib) const;
|
||||
bool has_siblings(size_t node) const;
|
||||
bool has_other_siblings(size_t node) const;
|
||||
|
||||
public:
|
||||
|
||||
@@ -163,6 +163,11 @@
|
||||
- Fix [cmake#8](https://github.com/biojppm/cmake/issues/8): `SOVERSION` missing from shared libraries.
|
||||
|
||||
|
||||
## Python
|
||||
|
||||
- The Python packages for Windows and MacOSX are causing problems in the CI, and were mostly disabled. The problematic packages are successfully made, but then fail to be imported. This was impossible to reproduce outside of the CI, and they were disabled since they were delaying the release. As a consequence, the Python release will have very limited compiled packages for Windows (only Python 3.6 and 3.7) or MacOSX. Help would be appreciated from those interested in these packages.
|
||||
|
||||
|
||||
## Thanks
|
||||
|
||||
- @NaN-git
|
||||
|
||||
Submodule ext/c4core updated: a0fb2bcb09...00d0b1d2f6
Reference in New Issue
Block a user