From 7e2c4b38bb3cea0e8f35b0ccf00f92bdd93736d8 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Wed, 20 Mar 2024 18:42:59 +0100 Subject: [PATCH 01/52] Use meson-python instead of setuptools for wheels --- .cirrus.yml | 9 ++--- bin/activate | 1 - bin/cibw.sh | 2 +- bin/pip_install_ubuntu.sh | 2 +- meson.build | 14 ++++++++ pyproject.toml | 4 +-- src/flint/flint_base/meson.build | 26 ++++++++++++++ src/flint/functions/meson.build | 23 +++++++++++++ src/flint/meson.build | 37 ++++++++++++++++++++ src/flint/test/meson.build | 13 +++++++ src/flint/types/meson.build | 58 ++++++++++++++++++++++++++++++++ src/flint/utils/meson.build | 24 +++++++++++++ 12 files changed, 202 insertions(+), 11 deletions(-) create mode 100644 meson.build create mode 100644 src/flint/flint_base/meson.build create mode 100644 src/flint/functions/meson.build create mode 100644 src/flint/meson.build create mode 100644 src/flint/test/meson.build create mode 100644 src/flint/types/meson.build create mode 100644 src/flint/utils/meson.build diff --git a/.cirrus.yml b/.cirrus.yml index 189079bc..99c4e602 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -10,12 +10,9 @@ cirrus_wheels_macos_arm64_task: PATH: /opt/homebrew/opt/python@3.10/bin:$PATH CIBW_ARCHS_MACOS: arm64 install_pre_requirements_script: - - brew install python@3.10 - - ln -s python3 /opt/homebrew/opt/python@3.10/bin/python - - which python - - python --version - install_cibuildwheel_script: - - python -m pip install cibuildwheel==2.16.2 + - python3 -m venv venv + - venv/bin/pip install --upgrade pip + - venv/bin/pip install cibuildwheel==2.16.2 run_cibuildwheel_script: - bin/cibw.sh wheels_artifacts: diff --git a/bin/activate b/bin/activate index 83f5d452..81e1eead 100644 --- a/bin/activate +++ b/bin/activate @@ -1,4 +1,3 @@ export C_INCLUDE_PATH=$(pwd)/.local/include export LIBRARY_PATH=$(pwd)/.local/lib export LD_LIBRARY_PATH=$(pwd)/.local/lib -export PYTHONPATH=$(pwd)/src diff --git a/bin/cibw.sh b/bin/cibw.sh index 23a70498..9e074891 100755 --- a/bin/cibw.sh +++ b/bin/cibw.sh @@ -15,4 +15,4 @@ export CIBW_TEST_COMMAND="python -m flint.test" # override setting in pyproject # cibuildwheel --platform linux # cibuildwheel --platform windows -cibuildwheel --platform macos +venv/bin/cibuildwheel --platform macos diff --git a/bin/pip_install_ubuntu.sh b/bin/pip_install_ubuntu.sh index dce9b9d0..b28e31e7 100755 --- a/bin/pip_install_ubuntu.sh +++ b/bin/pip_install_ubuntu.sh @@ -35,7 +35,7 @@ PYTHON_FLINT=$1 # First install their dependencies and build dependencies sudo apt-get update -sudo apt-get install libgmp-dev libmpfr-dev xz-utils +sudo apt-get install libgmp-dev libmpfr-dev xz-utils ninja-build if [ -z "$FLINT_GIT" ]; then # Install from release tarball diff --git a/meson.build b/meson.build new file mode 100644 index 00000000..3a67749d --- /dev/null +++ b/meson.build @@ -0,0 +1,14 @@ +project('python-flint', 'cython', 'c') + +py = import('python').find_installation(pure: false) +dep_py = py.dependency() + +cc = meson.get_compiler('c') + +gmp_dep = cc.find_library('gmp') +mpfr_dep = cc.find_library('mpfr') +flint_dep = cc.find_library('flint') + +pyflint_deps = [dep_py, gmp_dep, mpfr_dep, flint_dep] + +subdir('src/flint') diff --git a/pyproject.toml b/pyproject.toml index 19d18a8a..3b56c3b5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,8 @@ [build-system] -requires = ["setuptools", +requires = ["meson-python", "numpy; sys_platform == 'win32' and python_version < '3.12'", "Cython>=3"] -build-backend = "setuptools.build_meta" +build-backend = "mesonpy" [project] name = "python-flint" diff --git a/src/flint/flint_base/meson.build b/src/flint/flint_base/meson.build new file mode 100644 index 00000000..6c6943d7 --- /dev/null +++ b/src/flint/flint_base/meson.build @@ -0,0 +1,26 @@ +pkgdir = 'flint/flint_base' + +pyfiles = [ + '__init__.py', +] + +exts = [ + 'flint_base', + 'flint_context', +] + +py.install_sources( + pyfiles, + pure: false, + subdir: pkgdir, +) + +foreach ext : exts + py.extension_module( + ext, + ext + '.pyx', + dependencies: pyflint_deps, + install: true, + subdir: pkgdir, + ) +endforeach diff --git a/src/flint/functions/meson.build b/src/flint/functions/meson.build new file mode 100644 index 00000000..80f1f869 --- /dev/null +++ b/src/flint/functions/meson.build @@ -0,0 +1,23 @@ +pyfiles = [ + '__init__.py', +] + +exts = [ + 'showgood', +] + +py.install_sources( + pyfiles, + pure: false, + subdir: 'flint/functions', +) + +foreach ext : exts + py.extension_module( + ext, + ext + '.pyx', + dependencies: pyflint_deps, + install: true, + subdir: 'flint/functions', + ) +endforeach diff --git a/src/flint/meson.build b/src/flint/meson.build new file mode 100644 index 00000000..4ed3dc99 --- /dev/null +++ b/src/flint/meson.build @@ -0,0 +1,37 @@ +thisdir = 'flint' + +pyfiles = [ + '__init__.py', +] + +exts = [ + 'pyflint', +] + +pkgs = [ + 'flint_base', + 'types', + 'functions', + 'utils', + 'test', +] + +py.install_sources( + pyfiles, + pure: false, + subdir: thisdir, +) + +foreach ext : exts + py.extension_module( + ext, + ext + '.pyx', + dependencies: pyflint_deps, + install: true, + subdir: thisdir, + ) +endforeach + +foreach pkg : pkgs + subdir(pkg) +endforeach diff --git a/src/flint/test/meson.build b/src/flint/test/meson.build new file mode 100644 index 00000000..d551429b --- /dev/null +++ b/src/flint/test/meson.build @@ -0,0 +1,13 @@ +thisdir = 'flint/test' + +pyfiles = [ + '__init__.py', + '__main__.py', + 'test.py', +] + +py.install_sources( + pyfiles, + pure: false, + subdir: thisdir, +) diff --git a/src/flint/types/meson.build b/src/flint/types/meson.build new file mode 100644 index 00000000..bf8caec5 --- /dev/null +++ b/src/flint/types/meson.build @@ -0,0 +1,58 @@ +thisdir = 'flint/types' + +pyfiles = [ + '__init__.py', +] + +exts = [ + 'fmpz', + 'fmpz_poly', + 'fmpz_mat', + 'fmpz_series', + + 'fmpq', + 'fmpq_poly', + 'fmpq_mat', + 'fmpq_series', + + 'nmod', + 'nmod_poly', + 'nmod_mat', + 'nmod_series', + + 'fmpz_mod', + 'fmpz_mod_poly', + 'fmpz_mod_mat', + + 'arf', + + 'arb', + 'arb_poly', + 'arb_mat', + 'arb_series', + + 'acb', + 'acb_poly', + 'acb_mat', + 'acb_series', + + 'dirichlet', + + 'fmpz_mpoly', +] + +py.install_sources( + pyfiles, + pure: false, + subdir: thisdir, +) + +foreach ext : exts + py.extension_module( + ext, + ext + '.pyx', + dependencies: pyflint_deps, + install: true, + subdir: thisdir, + ) +endforeach diff --git a/src/flint/utils/meson.build b/src/flint/utils/meson.build new file mode 100644 index 00000000..d05a2dd9 --- /dev/null +++ b/src/flint/utils/meson.build @@ -0,0 +1,24 @@ +thisdir = 'flint/utils' + +pyfiles = [ + '__init__.py', + 'flint_exceptions.py', +] + +exts = [] + +py.install_sources( + pyfiles, + pure: false, + subdir: thisdir, +) + +foreach ext : exts + py.extension_module( + ext, + ext + '.pyx', + dependencies: pyflint_deps, + install: true, + subdir: thisdir, + ) +endforeach From c7d58a3bae81d50541f940f74abf420206e140c5 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Wed, 20 Mar 2024 21:36:20 +0100 Subject: [PATCH 02/52] Install dependencies when building the sdist --- .github/workflows/buildwheel.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index 88f79c62..487a03f1 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -54,6 +54,11 @@ jobs: with: python-version: '3.12' + - run: sudo apt-get update + - run: sudo apt-get install libgmp-dev libmpfr-dev xz-utils ninja-build + - run: curl -O -L https://www.flintlib.org/flint-3.1.0.tar.gz + - run: tar -xzf flint-3.1.0.tar.gz + - run: cd flint-3.1.0 && ./configure --disable-static && make -j4 && sudo make install - run: pip install build - run: python -m build --sdist From 066dd562b992ff395aea3bdbbb84a7eac6701121 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Wed, 20 Mar 2024 22:25:04 +0100 Subject: [PATCH 03/52] Use newer Ubuntu for CI job --- .github/workflows/buildwheel.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index 487a03f1..84b3de02 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -45,7 +45,7 @@ jobs: build_sdist: name: Build sdist - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 From 5c5ed7f49d9d6b4a533a585b72e8c77391d1e237 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 21 Mar 2024 11:42:15 +0100 Subject: [PATCH 04/52] Add lib directories to PATH for MinGW to find them --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 3b56c3b5..c4d1d27b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,6 +33,7 @@ test-command = "python -c \"import flint; print(str(flint.fmpz(2)))\"" C_INCLUDE_PATH = "$(pwd)/.local/include/" LIBRARY_PATH = "$(pwd)/.local/lib/" LD_LIBRARY_PATH = "$(pwd)/.local/lib:$LD_LIBRARY_PATH" +PATH = "$(pwd)/.local/bin:$(pwd)/.local/lib:$PATH" [tool.cibuildwheel.linux] before-all = "bin/cibw_before_all_linux.sh" From 1433d0289ea1dcd9caf5e320e80897a69352d141 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 21 Mar 2024 14:42:05 +0100 Subject: [PATCH 05/52] Use pkg-config to find the dependencies --- meson.build | 6 +++--- pyproject.toml | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index 3a67749d..02c1b872 100644 --- a/meson.build +++ b/meson.build @@ -5,9 +5,9 @@ dep_py = py.dependency() cc = meson.get_compiler('c') -gmp_dep = cc.find_library('gmp') -mpfr_dep = cc.find_library('mpfr') -flint_dep = cc.find_library('flint') +gmp_dep = dependency('gmp') +mpfr_dep = dependency('mpfr') +flint_dep = dependency('flint') pyflint_deps = [dep_py, gmp_dep, mpfr_dep, flint_dep] diff --git a/pyproject.toml b/pyproject.toml index c4d1d27b..737791e6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,6 +34,7 @@ C_INCLUDE_PATH = "$(pwd)/.local/include/" LIBRARY_PATH = "$(pwd)/.local/lib/" LD_LIBRARY_PATH = "$(pwd)/.local/lib:$LD_LIBRARY_PATH" PATH = "$(pwd)/.local/bin:$(pwd)/.local/lib:$PATH" +PKG_CONFIG_PATH = "$(pwd)/.local/lib/pkgconfig" [tool.cibuildwheel.linux] before-all = "bin/cibw_before_all_linux.sh" From 0c8003362868cd5457b19643b3e58e7e541e9908 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 21 Mar 2024 15:05:55 +0100 Subject: [PATCH 06/52] Install pkg-config when building Windows wheels --- bin/cibw_before_all_windows.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/cibw_before_all_windows.sh b/bin/cibw_before_all_windows.sh index 1b45da64..32c3be6c 100755 --- a/bin/cibw_before_all_windows.sh +++ b/bin/cibw_before_all_windows.sh @@ -17,6 +17,7 @@ cat setup.cfg pacman -S --noconfirm \ mingw-w64-x86_64-gcc\ mingw-w64-x86_64-tools-git\ + mingw-w64-x86_64-pkg-config\ m4\ make\ base-devel\ From c377c3f9009c821a3825e59faa6a152cac619092 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 21 Mar 2024 15:38:26 +0100 Subject: [PATCH 07/52] Use Flint 3.1.0 for alternate CPython jobs --- bin/pip_install_ubuntu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/pip_install_ubuntu.sh b/bin/pip_install_ubuntu.sh index b28e31e7..aa6a61c5 100755 --- a/bin/pip_install_ubuntu.sh +++ b/bin/pip_install_ubuntu.sh @@ -23,7 +23,7 @@ set -o errexit if [ -z "$2" ]; then echo "Building from release tarball" FLINT_GIT="" - FLINTVER=3.0.1 + FLINTVER=3.1.0 else echo "Building from git: $2" FLINT_GIT=$2 From 947dda53791a7ae2dccfebbd3462005692a2b4d0 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 21 Mar 2024 15:42:06 +0100 Subject: [PATCH 08/52] Use pkgconf instead of pkg-conf on Windows --- bin/cibw_before_all_windows.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/cibw_before_all_windows.sh b/bin/cibw_before_all_windows.sh index 32c3be6c..b29106a1 100755 --- a/bin/cibw_before_all_windows.sh +++ b/bin/cibw_before_all_windows.sh @@ -18,6 +18,7 @@ pacman -S --noconfirm \ mingw-w64-x86_64-gcc\ mingw-w64-x86_64-tools-git\ mingw-w64-x86_64-pkg-config\ + mingw-w64-x86_64-pkgconf\ m4\ make\ base-devel\ From b97136750acbde0802733582be8621e98caa8a0f Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 21 Mar 2024 15:51:39 +0100 Subject: [PATCH 09/52] Use 3.0.1 for alternate Python jobs --- bin/pip_install_ubuntu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/pip_install_ubuntu.sh b/bin/pip_install_ubuntu.sh index aa6a61c5..b28e31e7 100755 --- a/bin/pip_install_ubuntu.sh +++ b/bin/pip_install_ubuntu.sh @@ -23,7 +23,7 @@ set -o errexit if [ -z "$2" ]; then echo "Building from release tarball" FLINT_GIT="" - FLINTVER=3.1.0 + FLINTVER=3.0.1 else echo "Building from git: $2" FLINT_GIT=$2 From 64b7147df62eccf4070937c5afb9c724c0ea383d Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 21 Mar 2024 16:07:32 +0100 Subject: [PATCH 10/52] Install pkgconf in Windows --- bin/cibw_before_all_windows.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cibw_before_all_windows.sh b/bin/cibw_before_all_windows.sh index b29106a1..0a489e7b 100755 --- a/bin/cibw_before_all_windows.sh +++ b/bin/cibw_before_all_windows.sh @@ -18,7 +18,7 @@ pacman -S --noconfirm \ mingw-w64-x86_64-gcc\ mingw-w64-x86_64-tools-git\ mingw-w64-x86_64-pkg-config\ - mingw-w64-x86_64-pkgconf\ + pkgconf\ m4\ make\ base-devel\ From e2905170cfa0a9cf0c9343b8e53f07735c33a3ce Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 21 Mar 2024 17:02:28 +0100 Subject: [PATCH 11/52] Don't use path-type:inherit --- .github/workflows/buildwheel.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index 84b3de02..fdff82ec 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -28,7 +28,6 @@ jobs: # msys2/setup-msys2 README warns that using inherit here can be # problematic in some situations. Maybe there is a better way to do # this. - path-type: inherit if: ${{ matrix.os == 'windows-2019' }} - name: Build wheels From d19ffa56b48c7f5d8a1b89b95c3e5cc5d4eb818c Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 21 Mar 2024 17:06:50 +0100 Subject: [PATCH 12/52] Add back path-type: inherit --- .github/workflows/buildwheel.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index fdff82ec..84b3de02 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -28,6 +28,7 @@ jobs: # msys2/setup-msys2 README warns that using inherit here can be # problematic in some situations. Maybe there is a better way to do # this. + path-type: inherit if: ${{ matrix.os == 'windows-2019' }} - name: Build wheels From 4fa637179625bdb9116156f01141da113faf26ec Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 21 Mar 2024 17:14:07 +0100 Subject: [PATCH 13/52] Remove Strawberry Perl from Windows CI --- .github/workflows/buildwheel.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index 84b3de02..8e4f2dbe 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -31,6 +31,11 @@ jobs: path-type: inherit if: ${{ matrix.os == 'windows-2019' }} + # Remove Strawberry Perl to avoid conflicts with msys2 + # https://github.com/actions/runner-images/issues/5459 + - run: msys2 -c 'rm -rf /c/Strawberry' + if: ${{ matrix.os == 'windows-2019' }} + - name: Build wheels uses: pypa/cibuildwheel@v2.16.5 env: From bf18a354b782be0e1b8a30995f17d49dc29a6f53 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 21 Mar 2024 17:56:52 +0100 Subject: [PATCH 14/52] Install pkgconfig from choco --- .github/workflows/buildwheel.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index 8e4f2dbe..5eb62b74 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -36,6 +36,11 @@ jobs: - run: msys2 -c 'rm -rf /c/Strawberry' if: ${{ matrix.os == 'windows-2019' }} + # Install pkgconfig on Windows from choco rather than from msys and + # avoid using the Strawberry one. + - run: choco install -y --stoponfirstfailure --checksum 6004DF17818F5A6DBF19CB335CC92702 pkgconfiglite + if: ${{ matrix.os == 'windows-2019' }} + - name: Build wheels uses: pypa/cibuildwheel@v2.16.5 env: From 819f1d92ffa827a832906e752709d98a9c84e511 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 21 Mar 2024 18:25:39 +0100 Subject: [PATCH 15/52] Print pkgconfig files --- bin/build_dependencies_unix.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/build_dependencies_unix.sh b/bin/build_dependencies_unix.sh index 7f807a9f..df3bec1a 100755 --- a/bin/build_dependencies_unix.sh +++ b/bin/build_dependencies_unix.sh @@ -179,6 +179,10 @@ if [ $USE_GMP = "gmp" ]; then cd .. + ls $PREFIX/lib + ls $PREFIX/lib/pkgconfig + cat $PREFIX/lib/pkgconfig/gmp.pc + fi FLINTARB_WITHGMP="--with-gmp=$PREFIX" From 6fcd116407efdec31e2fc968005e75395f1e5adf Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 21 Mar 2024 18:54:41 +0100 Subject: [PATCH 16/52] Don't remove Strawbery --- .github/workflows/buildwheel.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index 5eb62b74..6fac88fd 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -31,11 +31,6 @@ jobs: path-type: inherit if: ${{ matrix.os == 'windows-2019' }} - # Remove Strawberry Perl to avoid conflicts with msys2 - # https://github.com/actions/runner-images/issues/5459 - - run: msys2 -c 'rm -rf /c/Strawberry' - if: ${{ matrix.os == 'windows-2019' }} - # Install pkgconfig on Windows from choco rather than from msys and # avoid using the Strawberry one. - run: choco install -y --stoponfirstfailure --checksum 6004DF17818F5A6DBF19CB335CC92702 pkgconfiglite From f63aed5f752f7aa88403cef4410208b43dbcaefd Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 21 Mar 2024 19:29:33 +0100 Subject: [PATCH 17/52] Show all files in .local --- bin/build_dependencies_unix.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bin/build_dependencies_unix.sh b/bin/build_dependencies_unix.sh index df3bec1a..734bb2c8 100755 --- a/bin/build_dependencies_unix.sh +++ b/bin/build_dependencies_unix.sh @@ -179,8 +179,7 @@ if [ $USE_GMP = "gmp" ]; then cd .. - ls $PREFIX/lib - ls $PREFIX/lib/pkgconfig + ls -R $PREFIX cat $PREFIX/lib/pkgconfig/gmp.pc fi From ddbddbb9e1a12920f08aba2c208c6ab4bbf4f71b Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 21 Mar 2024 19:35:25 +0100 Subject: [PATCH 18/52] Show all files after building --- bin/build_dependencies_unix.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/build_dependencies_unix.sh b/bin/build_dependencies_unix.sh index 734bb2c8..e033f65c 100755 --- a/bin/build_dependencies_unix.sh +++ b/bin/build_dependencies_unix.sh @@ -179,9 +179,6 @@ if [ $USE_GMP = "gmp" ]; then cd .. - ls -R $PREFIX - cat $PREFIX/lib/pkgconfig/gmp.pc - fi FLINTARB_WITHGMP="--with-gmp=$PREFIX" @@ -365,3 +362,8 @@ fi echo echo ----------------------------------------------------------------------- echo + + + +ls -R $PREFIX +cat $PREFIX/lib/pkgconfig/gmp.pc From f4b8aea249682687891d03dc7adca47896f7bf6f Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 21 Mar 2024 20:08:53 +0100 Subject: [PATCH 19/52] try copying the DLL to lib... --- bin/build_dependencies_unix.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/build_dependencies_unix.sh b/bin/build_dependencies_unix.sh index e033f65c..88a20aaa 100755 --- a/bin/build_dependencies_unix.sh +++ b/bin/build_dependencies_unix.sh @@ -179,6 +179,8 @@ if [ $USE_GMP = "gmp" ]; then cd .. + cp $PREFIX/bin/libgmp-10.dll $PREFIX/lib + fi FLINTARB_WITHGMP="--with-gmp=$PREFIX" From c1ae3933a963577199b2e157bfa085d56b767305 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 21 Mar 2024 20:34:13 +0100 Subject: [PATCH 20/52] try making libgmp.dll as well... --- bin/build_dependencies_unix.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/build_dependencies_unix.sh b/bin/build_dependencies_unix.sh index 88a20aaa..15ae435b 100755 --- a/bin/build_dependencies_unix.sh +++ b/bin/build_dependencies_unix.sh @@ -180,6 +180,7 @@ if [ $USE_GMP = "gmp" ]; then cd .. cp $PREFIX/bin/libgmp-10.dll $PREFIX/lib + cp $PREFIX/bin/libgmp-10.dll $PREFIX/lib/libgmp.dll fi From 3dd4088ddfa8f6dadeb17e3508dc8d04536fe11c Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 21 Mar 2024 21:07:01 +0100 Subject: [PATCH 21/52] print logs from CI ... --- .github/workflows/buildwheel.yml | 3 +++ pyproject.toml | 1 + 2 files changed, 4 insertions(+) diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index 6fac88fd..5645d168 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -43,6 +43,9 @@ jobs: CIBW_BEFORE_ALL_WINDOWS: msys2 -c bin/cibw_before_all_windows.sh CIBW_BEFORE_BUILD_WINDOWS: pip install delvewheel && msys2 -c bin/cibw_before_build_windows.sh + - run: cat mybuild/meson-logs/meson-log.txt + if: always() + - uses: actions/upload-artifact@v4 with: name: wheels-${{ matrix.os }} diff --git a/pyproject.toml b/pyproject.toml index 737791e6..794d9467 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,6 +27,7 @@ skip = "*-win32 *-manylinux_i686 *-musllinux_*" manylinux-x86_64-image = "manylinux2014" manylinux-i686-image = "manylinux2014" test-command = "python -c \"import flint; print(str(flint.fmpz(2)))\"" +build-frontend = { name = "pip", args = ["-C", "builddir=./mybuild"] } [tool.cibuildwheel.environment] # bin/build_dependencies_unix.sh places headers and shared libraries under .local From 615d3b738e892a93937bd20c9a480a10fb7f5d07 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 21 Mar 2024 21:58:04 +0100 Subject: [PATCH 22/52] Don't copy the files that only exist on Windows --- bin/build_dependencies_unix.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/bin/build_dependencies_unix.sh b/bin/build_dependencies_unix.sh index 15ae435b..e033f65c 100755 --- a/bin/build_dependencies_unix.sh +++ b/bin/build_dependencies_unix.sh @@ -179,9 +179,6 @@ if [ $USE_GMP = "gmp" ]; then cd .. - cp $PREFIX/bin/libgmp-10.dll $PREFIX/lib - cp $PREFIX/bin/libgmp-10.dll $PREFIX/lib/libgmp.dll - fi FLINTARB_WITHGMP="--with-gmp=$PREFIX" From 0849e1151777c9846980da42bc74bbc633d8ce38 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 21 Mar 2024 22:13:01 +0100 Subject: [PATCH 23/52] Only show logs on failure --- .github/workflows/buildwheel.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index 5645d168..3e1491c4 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -44,7 +44,7 @@ jobs: CIBW_BEFORE_BUILD_WINDOWS: pip install delvewheel && msys2 -c bin/cibw_before_build_windows.sh - run: cat mybuild/meson-logs/meson-log.txt - if: always() + if: failure() - uses: actions/upload-artifact@v4 with: From 34d97595f9099f10664cc3f06c87f8ca253e8f1f Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 21 Mar 2024 22:29:24 +0100 Subject: [PATCH 24/52] Try setting environment variable in GA .yml file... --- .github/workflows/buildwheel.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index 3e1491c4..8c2781b9 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -36,6 +36,9 @@ jobs: - run: choco install -y --stoponfirstfailure --checksum 6004DF17818F5A6DBF19CB335CC92702 pkgconfiglite if: ${{ matrix.os == 'windows-2019' }} + - run: echo "PKG_CONFIG_PATH=${{ github.workspace }}/.local/lib/pkgconfig" >> $env:GITHUB_ENV + if: ${{ matrix.os == 'windows-2019' }} + - name: Build wheels uses: pypa/cibuildwheel@v2.16.5 env: From d240b831b06970275d71dacdf2ebf6ffb9a131aa Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Fri, 22 Mar 2024 11:39:47 +0100 Subject: [PATCH 25/52] Don't override environment variables on Windows --- .github/workflows/buildwheel.yml | 3 --- pyproject.toml | 3 --- 2 files changed, 6 deletions(-) diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index 8c2781b9..3e1491c4 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -36,9 +36,6 @@ jobs: - run: choco install -y --stoponfirstfailure --checksum 6004DF17818F5A6DBF19CB335CC92702 pkgconfiglite if: ${{ matrix.os == 'windows-2019' }} - - run: echo "PKG_CONFIG_PATH=${{ github.workspace }}/.local/lib/pkgconfig" >> $env:GITHUB_ENV - if: ${{ matrix.os == 'windows-2019' }} - - name: Build wheels uses: pypa/cibuildwheel@v2.16.5 env: diff --git a/pyproject.toml b/pyproject.toml index 794d9467..3670ae44 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,6 +47,3 @@ before-all = "bin/cibw_before_all_macosx_$(uname -m).sh" before-all = "C:\\msys64\\usr\\bin\\bash bin/cibw_before_all_windows.sh" before-build = "pip install delvewheel && C:\\msys64\\usr\\bin\\bash bin/cibw_before_build_windows.sh" repair-wheel-command = "bin\\cibw_repair_wheel_command_windows.bat {dest_dir} {wheel}" - -[tool.cibuildwheel.windows.environment] -PYTHON_FLINT_MINGW64 = "true" From c23a58c5b8ec735dff6726c59afda4dbaea6d52f Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Fri, 22 Mar 2024 12:22:54 +0100 Subject: [PATCH 26/52] Add back the Windows cibuildwheel env var --- pyproject.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 3670ae44..d14da8f1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,3 +47,7 @@ before-all = "bin/cibw_before_all_macosx_$(uname -m).sh" before-all = "C:\\msys64\\usr\\bin\\bash bin/cibw_before_all_windows.sh" before-build = "pip install delvewheel && C:\\msys64\\usr\\bin\\bash bin/cibw_before_build_windows.sh" repair-wheel-command = "bin\\cibw_repair_wheel_command_windows.bat {dest_dir} {wheel}" + +[tool.cibuildwheel.windows.environment] +PYTHON_FLINT_MINGW64 = "true" +PKG_CONFIG_PATH = "$(pwd)/.local/lib/pkgconfig" From a03b6926afed3a34c338d6908a358898557b541e Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Fri, 22 Mar 2024 12:31:04 +0100 Subject: [PATCH 27/52] Remove PYTHON_FLINT_MINGW64 env var --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index d14da8f1..1a404145 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,5 +49,4 @@ before-build = "pip install delvewheel && C:\\msys64\\usr\\bin\\bash bin/cibw_be repair-wheel-command = "bin\\cibw_repair_wheel_command_windows.bat {dest_dir} {wheel}" [tool.cibuildwheel.windows.environment] -PYTHON_FLINT_MINGW64 = "true" PKG_CONFIG_PATH = "$(pwd)/.local/lib/pkgconfig" From a9d07c056028bcee974e7046c9ce9ab66213dc85 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Fri, 22 Mar 2024 13:17:37 +0100 Subject: [PATCH 28/52] Set env var in GA yml file again --- .github/workflows/buildwheel.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index 3e1491c4..d6f6fa4f 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -36,6 +36,12 @@ jobs: - run: choco install -y --stoponfirstfailure --checksum 6004DF17818F5A6DBF19CB335CC92702 pkgconfiglite if: ${{ matrix.os == 'windows-2019' }} + - run: echo "PKG_CONFIG_PATH=${{ github.workspace }}/.local/lib/pkgconfig" >> $env:GITHUB_ENV + if: ${{ matrix.os == 'windows-2019' }} + + - run: echo $PKG_CONFIG_PATH + if: ${{ matrix.os == 'windows-2019' }} + - name: Build wheels uses: pypa/cibuildwheel@v2.16.5 env: From 1f7bcd8c1e067dd20a8f4e2e0ebe7226cd7e1584 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Fri, 22 Mar 2024 13:54:38 +0100 Subject: [PATCH 29/52] Restore fully to when the Windows build worked... --- .github/workflows/buildwheel.yml | 3 --- pyproject.toml | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index d6f6fa4f..8c2781b9 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -39,9 +39,6 @@ jobs: - run: echo "PKG_CONFIG_PATH=${{ github.workspace }}/.local/lib/pkgconfig" >> $env:GITHUB_ENV if: ${{ matrix.os == 'windows-2019' }} - - run: echo $PKG_CONFIG_PATH - if: ${{ matrix.os == 'windows-2019' }} - - name: Build wheels uses: pypa/cibuildwheel@v2.16.5 env: diff --git a/pyproject.toml b/pyproject.toml index 1a404145..794d9467 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,4 +49,4 @@ before-build = "pip install delvewheel && C:\\msys64\\usr\\bin\\bash bin/cibw_be repair-wheel-command = "bin\\cibw_repair_wheel_command_windows.bat {dest_dir} {wheel}" [tool.cibuildwheel.windows.environment] -PKG_CONFIG_PATH = "$(pwd)/.local/lib/pkgconfig" +PYTHON_FLINT_MINGW64 = "true" From 0647f59eef05c0f950a0562815b80955f019084a Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Fri, 22 Mar 2024 17:33:31 +0100 Subject: [PATCH 30/52] Remove MINGGW^$ var --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 794d9467..5a7a6d61 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,4 +49,3 @@ before-build = "pip install delvewheel && C:\\msys64\\usr\\bin\\bash bin/cibw_be repair-wheel-command = "bin\\cibw_repair_wheel_command_windows.bat {dest_dir} {wheel}" [tool.cibuildwheel.windows.environment] -PYTHON_FLINT_MINGW64 = "true" From cb8aa778d500ea061a98885ad380dc17a3989d94 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Sat, 23 Mar 2024 09:25:08 +0000 Subject: [PATCH 31/52] Remove environment variables from unix build in CI --- pyproject.toml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 5a7a6d61..cfe8bb41 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,12 +30,6 @@ test-command = "python -c \"import flint; print(str(flint.fmpz(2)))\"" build-frontend = { name = "pip", args = ["-C", "builddir=./mybuild"] } [tool.cibuildwheel.environment] -# bin/build_dependencies_unix.sh places headers and shared libraries under .local -C_INCLUDE_PATH = "$(pwd)/.local/include/" -LIBRARY_PATH = "$(pwd)/.local/lib/" -LD_LIBRARY_PATH = "$(pwd)/.local/lib:$LD_LIBRARY_PATH" -PATH = "$(pwd)/.local/bin:$(pwd)/.local/lib:$PATH" -PKG_CONFIG_PATH = "$(pwd)/.local/lib/pkgconfig" [tool.cibuildwheel.linux] before-all = "bin/cibw_before_all_linux.sh" From 06c297d91fbde787b5aa0c40094aab684b236998 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Sat, 23 Mar 2024 09:34:47 +0000 Subject: [PATCH 32/52] Add back PKG_CONFIG_PATH on unix --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index cfe8bb41..15890e7c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,6 +30,7 @@ test-command = "python -c \"import flint; print(str(flint.fmpz(2)))\"" build-frontend = { name = "pip", args = ["-C", "builddir=./mybuild"] } [tool.cibuildwheel.environment] +PKG_CONFIG_PATH = "$(pwd)/.local/lib/pkgconfig" [tool.cibuildwheel.linux] before-all = "bin/cibw_before_all_linux.sh" From 7c665d9bb03ebfddda3c65a272003540d3a81660 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Sat, 23 Mar 2024 09:52:39 +0000 Subject: [PATCH 33/52] Add back LD_LBRARY_PATH for auditwheel --- pyproject.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 15890e7c..45e082b9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,6 +30,8 @@ test-command = "python -c \"import flint; print(str(flint.fmpz(2)))\"" build-frontend = { name = "pip", args = ["-C", "builddir=./mybuild"] } [tool.cibuildwheel.environment] +# LD_LIBRARY_PATH is needed by auditwheel on Linux +LD_LIBRARY_PATH = "$(pwd)/.local/lib:$LD_LIBRARY_PATH" PKG_CONFIG_PATH = "$(pwd)/.local/lib/pkgconfig" [tool.cibuildwheel.linux] From 6d76c184b4def164f7ddcc2efac26467cc6957b2 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Sat, 23 Mar 2024 13:54:46 +0000 Subject: [PATCH 34/52] Try setting PKG_CONFIG_PATH both ways... --- bin/cibw_before_all_windows.sh | 4 ++++ pyproject.toml | 1 + 2 files changed, 5 insertions(+) diff --git a/bin/cibw_before_all_windows.sh b/bin/cibw_before_all_windows.sh index 0a489e7b..ab69a55f 100755 --- a/bin/cibw_before_all_windows.sh +++ b/bin/cibw_before_all_windows.sh @@ -5,6 +5,10 @@ set -o errexit # Uncomment this to run cibuildwheel locally on Windows: # export PATH=$PATH:/c/msys64/usr/bin:/c/msys64/mingw64/bin +echo $PKG_CONFIG_PATH +echo $PKG_CONFIG_PATH2 +exit 1 + # # Make a setup.cfg to specify compiling with mingw64 (even though it says # mingw32...) diff --git a/pyproject.toml b/pyproject.toml index 45e082b9..7f97c9e4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,3 +46,4 @@ before-build = "pip install delvewheel && C:\\msys64\\usr\\bin\\bash bin/cibw_be repair-wheel-command = "bin\\cibw_repair_wheel_command_windows.bat {dest_dir} {wheel}" [tool.cibuildwheel.windows.environment] +PKG_CONFIG_PATH2 = "$(pwd)/.local/lib/pkgconfig" From 9c89ad961d8c249dbfedd89ed1459ea02c6b8a09 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Sat, 23 Mar 2024 14:01:20 +0000 Subject: [PATCH 35/52] Set 3rd PKG_CONFIG_PATH --- .github/workflows/buildwheel.yml | 3 +++ bin/cibw_before_all_windows.sh | 1 + 2 files changed, 4 insertions(+) diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index 8c2781b9..467c6504 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -39,6 +39,9 @@ jobs: - run: echo "PKG_CONFIG_PATH=${{ github.workspace }}/.local/lib/pkgconfig" >> $env:GITHUB_ENV if: ${{ matrix.os == 'windows-2019' }} + - run: echo "PKG_CONFIG_PATH3=${{ github.workspace }}/.local/lib/pkgconfig" >> $env:GITHUB_ENV + if: ${{ matrix.os == 'windows-2019' }} + - name: Build wheels uses: pypa/cibuildwheel@v2.16.5 env: diff --git a/bin/cibw_before_all_windows.sh b/bin/cibw_before_all_windows.sh index ab69a55f..2ac14fb6 100755 --- a/bin/cibw_before_all_windows.sh +++ b/bin/cibw_before_all_windows.sh @@ -7,6 +7,7 @@ set -o errexit echo $PKG_CONFIG_PATH echo $PKG_CONFIG_PATH2 +echo $PKG_CONFIG_PATH3 exit 1 # From 5fd90e260d4ad3d9ace1ff63c06ab4882458d5d7 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Sat, 23 Mar 2024 14:13:44 +0000 Subject: [PATCH 36/52] Don't set any environment variables on Windows --- .github/workflows/buildwheel.yml | 6 ------ bin/cibw_before_all_windows.sh | 5 ----- pyproject.toml | 13 ++++++++----- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index 467c6504..3e1491c4 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -36,12 +36,6 @@ jobs: - run: choco install -y --stoponfirstfailure --checksum 6004DF17818F5A6DBF19CB335CC92702 pkgconfiglite if: ${{ matrix.os == 'windows-2019' }} - - run: echo "PKG_CONFIG_PATH=${{ github.workspace }}/.local/lib/pkgconfig" >> $env:GITHUB_ENV - if: ${{ matrix.os == 'windows-2019' }} - - - run: echo "PKG_CONFIG_PATH3=${{ github.workspace }}/.local/lib/pkgconfig" >> $env:GITHUB_ENV - if: ${{ matrix.os == 'windows-2019' }} - - name: Build wheels uses: pypa/cibuildwheel@v2.16.5 env: diff --git a/bin/cibw_before_all_windows.sh b/bin/cibw_before_all_windows.sh index 2ac14fb6..0a489e7b 100755 --- a/bin/cibw_before_all_windows.sh +++ b/bin/cibw_before_all_windows.sh @@ -5,11 +5,6 @@ set -o errexit # Uncomment this to run cibuildwheel locally on Windows: # export PATH=$PATH:/c/msys64/usr/bin:/c/msys64/mingw64/bin -echo $PKG_CONFIG_PATH -echo $PKG_CONFIG_PATH2 -echo $PKG_CONFIG_PATH3 -exit 1 - # # Make a setup.cfg to specify compiling with mingw64 (even though it says # mingw32...) diff --git a/pyproject.toml b/pyproject.toml index 7f97c9e4..ab339fa2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,11 +29,17 @@ manylinux-i686-image = "manylinux2014" test-command = "python -c \"import flint; print(str(flint.fmpz(2)))\"" build-frontend = { name = "pip", args = ["-C", "builddir=./mybuild"] } -[tool.cibuildwheel.environment] -# LD_LIBRARY_PATH is needed by auditwheel on Linux +[tool.cibuildwheel.linux.environment] +# LD_LIBRARY_PATH is needed by auditwheel LD_LIBRARY_PATH = "$(pwd)/.local/lib:$LD_LIBRARY_PATH" PKG_CONFIG_PATH = "$(pwd)/.local/lib/pkgconfig" +[tool.cibuildwheel.macos.environment] +PKG_CONFIG_PATH = "$(pwd)/.local/lib/pkgconfig" + +[tool.cibuildwheel.windows.environment] +# Setting PKG_CONFIG_PATH here breaks pkgconfig for some reason... + [tool.cibuildwheel.linux] before-all = "bin/cibw_before_all_linux.sh" @@ -44,6 +50,3 @@ before-all = "bin/cibw_before_all_macosx_$(uname -m).sh" before-all = "C:\\msys64\\usr\\bin\\bash bin/cibw_before_all_windows.sh" before-build = "pip install delvewheel && C:\\msys64\\usr\\bin\\bash bin/cibw_before_build_windows.sh" repair-wheel-command = "bin\\cibw_repair_wheel_command_windows.bat {dest_dir} {wheel}" - -[tool.cibuildwheel.windows.environment] -PKG_CONFIG_PATH2 = "$(pwd)/.local/lib/pkgconfig" From e3576c021a3fb7fa6268f2907d9fe45e1a578116 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Sat, 23 Mar 2024 14:41:29 +0000 Subject: [PATCH 37/52] try setting PKG_CONFIG_PATH --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index ab339fa2..48fae393 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,6 +39,7 @@ PKG_CONFIG_PATH = "$(pwd)/.local/lib/pkgconfig" [tool.cibuildwheel.windows.environment] # Setting PKG_CONFIG_PATH here breaks pkgconfig for some reason... +PKG_CONFIG_PATH = "$(pwd)/.local/lib/pkgconfig:$PKG_CONFIG_PATH" [tool.cibuildwheel.linux] before-all = "bin/cibw_before_all_linux.sh" From 4517a375d58d31adb4b6918382d9c0b9da789c9d Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Sat, 23 Mar 2024 15:45:34 +0000 Subject: [PATCH 38/52] Set PKG_CONFIG_PATH in CI workflow --- .github/workflows/buildwheel.yml | 4 ++++ pyproject.toml | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index 3e1491c4..09488cf9 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -36,6 +36,10 @@ jobs: - run: choco install -y --stoponfirstfailure --checksum 6004DF17818F5A6DBF19CB335CC92702 pkgconfiglite if: ${{ matrix.os == 'windows-2019' }} + # We have to set this here rather than in the cibuildwheel config + - run: echo "PKG_CONFIG_PATH=${{ github.workspace }}/.local/lib/pkgconfig" >> $env:GITHUB_ENV + if: ${{ matrix.os == 'windows-2019' }} + - name: Build wheels uses: pypa/cibuildwheel@v2.16.5 env: diff --git a/pyproject.toml b/pyproject.toml index 48fae393..9bf4a29b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,7 +39,8 @@ PKG_CONFIG_PATH = "$(pwd)/.local/lib/pkgconfig" [tool.cibuildwheel.windows.environment] # Setting PKG_CONFIG_PATH here breaks pkgconfig for some reason... -PKG_CONFIG_PATH = "$(pwd)/.local/lib/pkgconfig:$PKG_CONFIG_PATH" +# We set it in the CI workflow instead. +# PKG_CONFIG_PATH = "$(pwd)/.local/lib/pkgconfig:$PKG_CONFIG_PATH" [tool.cibuildwheel.linux] before-all = "bin/cibw_before_all_linux.sh" From 46fe647773442aac4acf3e925e9aab5e9af73422 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Sun, 24 Mar 2024 14:11:49 +0000 Subject: [PATCH 39/52] Add temporary CI job --- .github/workflows/build_test.yml | 21 ++++++++++++++++++++ bin/build_install.sh | 34 ++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 .github/workflows/build_test.yml create mode 100755 bin/build_install.sh diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml new file mode 100644 index 00000000..742eb81e --- /dev/null +++ b/.github/workflows/build_test.yml @@ -0,0 +1,21 @@ +name: Build Test + +on: [push, pull_request] + +jobs: + + build_test: + name: Build with flint ${{ matrix.flintver }} + runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + # All supported versions + flintver: ['3.0.0', '3.0.1', '3.1.0'] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.12 + - run: bin/build_install.sh ${{ matrix.flintver }} + - run: python -m flint.test diff --git a/bin/build_install.sh b/bin/build_install.sh new file mode 100755 index 00000000..f08609a8 --- /dev/null +++ b/bin/build_install.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +set -o errexit + +FLINTVER=$1 + +# Install GMP, MPFR and build tools from Ubuntu repos +sudo apt-get update +sudo apt-get install libgmp-dev libmpfr-dev xz-utils ninja-build + +# Build flint and install to /usr/local +curl -O -L https://www.flintlib.org/flint-$FLINTVER.tar.gz +tar xf flint-$FLINTVER.tar.gz +cd flint-$FLINTVER + ./bootstrap.sh + ./configure --disable-static + make -j + sudo make install +cd .. + +# Ensure the the libflint.so is found at runtime +sudo ldconfig /usr/local/lib + +echo "Contents of /usr/local/lib:" +ls -l /usr/local/lib +echo + +echo "Contents of /usr/local/lib/pkgconfig/flint.pc:" +cat /usr/local/lib/pkgconfig/flint.pc +echo + +# Build python-flint using meson-python. This will use pkgconfig to find the +# flint library installed in /usr/local. +pip install . From df3d92376b65ff9445d6b15ccd40214f512022d7 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Mon, 25 Mar 2024 11:38:06 +0000 Subject: [PATCH 40/52] Add -lfint for Flint < 3.1.0 --- meson.build | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/meson.build b/meson.build index 02c1b872..68d6a927 100644 --- a/meson.build +++ b/meson.build @@ -9,6 +9,14 @@ gmp_dep = dependency('gmp') mpfr_dep = dependency('mpfr') flint_dep = dependency('flint') +flint_dep = dependency('flint') +if flint_dep.version().version_compare('<3.1') + flint_dep = declare_dependency( + dependencies: flint_dep, + link_args: ['-lflint'], + ) +endif + pyflint_deps = [dep_py, gmp_dep, mpfr_dep, flint_dep] subdir('src/flint') From 20bfdfa4344e5fcfdc68de247509fc029c39a6d0 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Mon, 25 Mar 2024 14:53:09 +0000 Subject: [PATCH 41/52] Use cc.find_library --- meson.build | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/meson.build b/meson.build index 68d6a927..b176e1c2 100644 --- a/meson.build +++ b/meson.build @@ -10,11 +10,11 @@ mpfr_dep = dependency('mpfr') flint_dep = dependency('flint') flint_dep = dependency('flint') + if flint_dep.version().version_compare('<3.1') - flint_dep = declare_dependency( - dependencies: flint_dep, - link_args: ['-lflint'], - ) + # This is a workaround for the fact that the flint.pc file in flint < 3.1 + # is missing -lflint. This is fixed in flint 3.1.0. + flint_dep = cc.find_library('flint') endif pyflint_deps = [dep_py, gmp_dep, mpfr_dep, flint_dep] From bd97d071628561d31bc6d52b00c49376523122e8 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Mon, 25 Mar 2024 21:19:19 +0000 Subject: [PATCH 42/52] Update OSX runners to macos-13 --- .github/workflows/buildwheel.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index 09488cf9..0dd597a3 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-20.04, windows-2019, macos-12] + os: [ubuntu-20.04, windows-2019, macos-13] steps: - uses: actions/checkout@v4 @@ -108,7 +108,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-20.04, windows-2019, macos-12] + os: [ubuntu-20.04, windows-2019, macos-13] python-version: ['3.9', '3.10', '3.11', '3.12'] steps: From 2bb1443d98695ec8364dc3abd7758e4a48cb04a2 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Mon, 25 Mar 2024 22:25:05 +0000 Subject: [PATCH 43/52] Remove old cibw.sh script --- .cirrus.yml | 3 ++- bin/cibw.sh | 18 ------------------ 2 files changed, 2 insertions(+), 19 deletions(-) delete mode 100755 bin/cibw.sh diff --git a/.cirrus.yml b/.cirrus.yml index 99c4e602..3970103e 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -9,11 +9,12 @@ cirrus_wheels_macos_arm64_task: env: PATH: /opt/homebrew/opt/python@3.10/bin:$PATH CIBW_ARCHS_MACOS: arm64 + CIBW_TEST_COMMAND: "python -m flint.test" install_pre_requirements_script: - python3 -m venv venv - venv/bin/pip install --upgrade pip - venv/bin/pip install cibuildwheel==2.16.2 run_cibuildwheel_script: - - bin/cibw.sh + - venv/bin/cibuildwheel --platform macos wheels_artifacts: path: "wheelhouse/*" diff --git a/bin/cibw.sh b/bin/cibw.sh deleted file mode 100755 index 9e074891..00000000 --- a/bin/cibw.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash -# -# This script can be used to test cibuildwheel locally on OSX/Linux -# -# It is also worth commenting out the BEFORE_ALL line to build GMP etc after you have -# built those once because that is by far the slowest step. -# - -rm -f wheelhouse/* - -# export CIBW_ARCHS_MACOS="x86_64" -export CIBW_ARCHS_MACOS="arm64" - -export CIBW_TEST_COMMAND="python -m flint.test" # override setting in pyproject.toml - -# cibuildwheel --platform linux -# cibuildwheel --platform windows -venv/bin/cibuildwheel --platform macos From 9b1539f9c9a4f04a33cabff1002dbb880c0865d2 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Mon, 25 Mar 2024 22:26:10 +0000 Subject: [PATCH 44/52] Remove temp CI job --- .github/workflows/build_test.yml | 21 -------------------- bin/build_install.sh | 34 -------------------------------- 2 files changed, 55 deletions(-) delete mode 100644 .github/workflows/build_test.yml delete mode 100755 bin/build_install.sh diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml deleted file mode 100644 index 742eb81e..00000000 --- a/.github/workflows/build_test.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Build Test - -on: [push, pull_request] - -jobs: - - build_test: - name: Build with flint ${{ matrix.flintver }} - runs-on: ubuntu-22.04 - strategy: - fail-fast: false - matrix: - # All supported versions - flintver: ['3.0.0', '3.0.1', '3.1.0'] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: 3.12 - - run: bin/build_install.sh ${{ matrix.flintver }} - - run: python -m flint.test diff --git a/bin/build_install.sh b/bin/build_install.sh deleted file mode 100755 index f08609a8..00000000 --- a/bin/build_install.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -set -o errexit - -FLINTVER=$1 - -# Install GMP, MPFR and build tools from Ubuntu repos -sudo apt-get update -sudo apt-get install libgmp-dev libmpfr-dev xz-utils ninja-build - -# Build flint and install to /usr/local -curl -O -L https://www.flintlib.org/flint-$FLINTVER.tar.gz -tar xf flint-$FLINTVER.tar.gz -cd flint-$FLINTVER - ./bootstrap.sh - ./configure --disable-static - make -j - sudo make install -cd .. - -# Ensure the the libflint.so is found at runtime -sudo ldconfig /usr/local/lib - -echo "Contents of /usr/local/lib:" -ls -l /usr/local/lib -echo - -echo "Contents of /usr/local/lib/pkgconfig/flint.pc:" -cat /usr/local/lib/pkgconfig/flint.pc -echo - -# Build python-flint using meson-python. This will use pkgconfig to find the -# flint library installed in /usr/local. -pip install . From 6af8e93d5fe14e27e85209c9c958a24e5f2cc73b Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Mon, 25 Mar 2024 22:29:11 +0000 Subject: [PATCH 45/52] Use isolated build directory --- .github/workflows/buildwheel.yml | 4 +--- pyproject.toml | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index 0dd597a3..536d00c9 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -37,6 +37,7 @@ jobs: if: ${{ matrix.os == 'windows-2019' }} # We have to set this here rather than in the cibuildwheel config + # This is probably something to do with \ vs / in paths... - run: echo "PKG_CONFIG_PATH=${{ github.workspace }}/.local/lib/pkgconfig" >> $env:GITHUB_ENV if: ${{ matrix.os == 'windows-2019' }} @@ -47,9 +48,6 @@ jobs: CIBW_BEFORE_ALL_WINDOWS: msys2 -c bin/cibw_before_all_windows.sh CIBW_BEFORE_BUILD_WINDOWS: pip install delvewheel && msys2 -c bin/cibw_before_build_windows.sh - - run: cat mybuild/meson-logs/meson-log.txt - if: failure() - - uses: actions/upload-artifact@v4 with: name: wheels-${{ matrix.os }} diff --git a/pyproject.toml b/pyproject.toml index 9bf4a29b..0009bf87 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,7 +27,6 @@ skip = "*-win32 *-manylinux_i686 *-musllinux_*" manylinux-x86_64-image = "manylinux2014" manylinux-i686-image = "manylinux2014" test-command = "python -c \"import flint; print(str(flint.fmpz(2)))\"" -build-frontend = { name = "pip", args = ["-C", "builddir=./mybuild"] } [tool.cibuildwheel.linux.environment] # LD_LIBRARY_PATH is needed by auditwheel From 8cbb5f1b8ce78fd437546930d72a487d21d4ddb0 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Mon, 25 Mar 2024 22:30:42 +0000 Subject: [PATCH 46/52] Remove msys pkgconfig --- bin/cibw_before_all_windows.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/bin/cibw_before_all_windows.sh b/bin/cibw_before_all_windows.sh index 0a489e7b..1b45da64 100755 --- a/bin/cibw_before_all_windows.sh +++ b/bin/cibw_before_all_windows.sh @@ -17,8 +17,6 @@ cat setup.cfg pacman -S --noconfirm \ mingw-w64-x86_64-gcc\ mingw-w64-x86_64-tools-git\ - mingw-w64-x86_64-pkg-config\ - pkgconf\ m4\ make\ base-devel\ From 899858f6e9aaa22096fa31e83572ff86743ec85a Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Mon, 25 Mar 2024 22:37:13 +0000 Subject: [PATCH 47/52] Remove unnecessary build dependencies --- bin/build_dependencies_unix.sh | 5 ----- meson.build | 3 +-- pyproject.toml | 4 +--- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/bin/build_dependencies_unix.sh b/bin/build_dependencies_unix.sh index e033f65c..7f807a9f 100755 --- a/bin/build_dependencies_unix.sh +++ b/bin/build_dependencies_unix.sh @@ -362,8 +362,3 @@ fi echo echo ----------------------------------------------------------------------- echo - - - -ls -R $PREFIX -cat $PREFIX/lib/pkgconfig/gmp.pc diff --git a/meson.build b/meson.build index b176e1c2..f7afc2c5 100644 --- a/meson.build +++ b/meson.build @@ -11,9 +11,8 @@ flint_dep = dependency('flint') flint_dep = dependency('flint') +# flint.pc was missing -lflint until Flint 3.1.0 if flint_dep.version().version_compare('<3.1') - # This is a workaround for the fact that the flint.pc file in flint < 3.1 - # is missing -lflint. This is fixed in flint 3.1.0. flint_dep = cc.find_library('flint') endif diff --git a/pyproject.toml b/pyproject.toml index 0009bf87..f80ab4cc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,5 @@ [build-system] -requires = ["meson-python", - "numpy; sys_platform == 'win32' and python_version < '3.12'", - "Cython>=3"] +requires = ["meson-python"] build-backend = "mesonpy" [project] From 844de58d95e434c43f661f3e647e620f30ccb12a Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Mon, 25 Mar 2024 22:42:40 +0000 Subject: [PATCH 48/52] Add cython back tothe build dependencies --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index f80ab4cc..d6e7e8ba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["meson-python"] +requires = ["meson-python", "cython"] build-backend = "mesonpy" [project] From 963d47ff92b1697340efade14c3b540b154e9d5d Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Tue, 26 Mar 2024 00:56:32 +0000 Subject: [PATCH 49/52] Remove redundant dependency line in meson.build --- meson.build | 2 -- 1 file changed, 2 deletions(-) diff --git a/meson.build b/meson.build index f7afc2c5..b4fe7f83 100644 --- a/meson.build +++ b/meson.build @@ -9,8 +9,6 @@ gmp_dep = dependency('gmp') mpfr_dep = dependency('mpfr') flint_dep = dependency('flint') -flint_dep = dependency('flint') - # flint.pc was missing -lflint until Flint 3.1.0 if flint_dep.version().version_compare('<3.1') flint_dep = cc.find_library('flint') From b0e0e3b43dfdf0a709ec6015a59c044fd40d7987 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 4 Apr 2024 23:42:02 +0100 Subject: [PATCH 50/52] rename test.py -> test_all.py for pytest --- src/flint/test/__main__.py | 2 +- src/flint/test/meson.build | 2 +- src/flint/test/{test.py => test_all.py} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename src/flint/test/{test.py => test_all.py} (100%) diff --git a/src/flint/test/__main__.py b/src/flint/test/__main__.py index 637fdb46..d16b0aa5 100644 --- a/src/flint/test/__main__.py +++ b/src/flint/test/__main__.py @@ -10,7 +10,7 @@ import argparse import flint -from flint.test.test import all_tests +from flint.test.test_all import all_tests def run_tests(verbose=None): diff --git a/src/flint/test/meson.build b/src/flint/test/meson.build index d551429b..4aa245a1 100644 --- a/src/flint/test/meson.build +++ b/src/flint/test/meson.build @@ -3,7 +3,7 @@ thisdir = 'flint/test' pyfiles = [ '__init__.py', '__main__.py', - 'test.py', + 'test_all.py', ] py.install_sources( diff --git a/src/flint/test/test.py b/src/flint/test/test_all.py similarity index 100% rename from src/flint/test/test.py rename to src/flint/test/test_all.py From c2ccbdc55a691eccea06887d65848803349fc4a0 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 4 Apr 2024 23:42:33 +0100 Subject: [PATCH 51/52] ignore hypothesis --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 213e156f..0f4570f3 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ MANIFEST .python-version *.DS_Store .venv +.hypothesis From cfe2feab5cb02fc1f39f567206c8a169d7c93c17 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Fri, 5 Apr 2024 00:13:44 +0100 Subject: [PATCH 52/52] Add spin cofiguration --- pyproject.toml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index d6e7e8ba..e29f7ccf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,6 +19,27 @@ classifiers = [ file = "README.md" content-type = "text/markdown" +[tool.spin] +package = "flint" + +[tool.spin.commands] + +"Build" = [ + "spin.cmds.meson.build", + "spin.cmds.meson.test", + "spin.cmds.build.sdist", + "spin.cmds.pip.install", +] +"Documentation" = [ + "spin.cmds.meson.docs", +] +"Environments" = [ + "spin.cmds.meson.shell", + "spin.cmds.meson.ipython", + "spin.cmds.meson.python", + "spin.cmds.meson.run", +] + [tool.cibuildwheel] build = "cp39-* cp310-* cp311-* cp312-*" skip = "*-win32 *-manylinux_i686 *-musllinux_*"