Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
5e144e7
.gitignore: ignore CMakeCache.txt and CMakeFiles
gsmecher Dec 15, 2025
f9cff67
msvc: don't define FILENAME_MAX if it already exists
gsmecher Dec 16, 2025
3baa45e
Windows: MSVC: Poison GD_TRUNC for now - it is unsafe to unlink while…
gsmecher Dec 16, 2025
fe8536d
big_test.py (Python tests): Python 2.x -> 3.x exception update
gsmecher Dec 15, 2025
2355082
big_test.py (Python tests): gracefully handle builds without regex/pc…
gsmecher Dec 16, 2025
f99b653
big_test.py (Python tests): CheckEOS: escape input before using re.se…
gsmecher Dec 16, 2025
5092790
big_test.py (Python tests): use path.join for "expected results" with…
gsmecher Dec 16, 2025
7053593
bindings/python: callback.py tests: win32 portability (CRLF and path …
gsmecher Dec 17, 2025
7580825
cmake modernization and python bindings
gsmecher Dec 14, 2025
665d827
CMake: correctly wrangle tests with exit code 77 (autotools conventio…
gsmecher Dec 15, 2025
f10a2ca
bindings/python: move pyproject.toml to CMake backend
gsmecher Dec 15, 2025
513dba5
Github workflows: add CMake regression tests and Windows wheels
gsmecher Dec 16, 2025
7dc518c
test/c89*: place GD_C89_API in an #ifndef guard to squash redefinitio…
gsmecher Dec 16, 2025
855ec88
test/version_5: fix #ifdef within macro expansion
gsmecher Dec 16, 2025
b91b7d6
Remove HAVE_CONFIG_H macro entirely
gsmecher Dec 16, 2025
d509ce0
.github/workflows/package.yml: upgrade cibuildwheel; add Python 3.13/…
gsmecher Dec 17, 2025
5d13185
bindings/python/pyproject.toml: Teach scikit-build to extract the ver…
gsmecher Dec 17, 2025
1da0110
package.yml: wheel builder: no need to SKIP Python 3.6/3.7 any more
gsmecher Dec 17, 2025
938b4fd
CMake/wheels: properly configure and install utils (checkdirfile, dir…
gsmecher Dec 18, 2025
153982c
MSVC: work around #define snprintf _snprintf in stdio.h
gsmecher Dec 18, 2025
bdf7dde
wheel build: use shared libraries; teach wheel repair steps how to fi…
gsmecher Dec 18, 2025
f7099e1
CMake: Add BUILD_CXX compile option; disable it for pyproject.toml en…
gsmecher Dec 18, 2025
9ce55ba
CMake: Correct .dll placement for Windows
gsmecher Dec 19, 2025
d626c9c
CMake: extract GETDATA_VERSION macros from m4/version.m4
gsmecher Dec 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions .github/workflows/bootstrap.sh

This file was deleted.

49 changes: 49 additions & 0 deletions .github/workflows/cmake-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: CMake CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
cmake-build-test:
name: CMake on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
deps: sudo apt-get update && sudo apt-get install -y cmake bzip2 gzip xz-utils flac zip unzip libbz2-dev liblzma-dev libflac-dev libpcre3-dev libzzip-dev
- os: macos-latest
deps: brew install --quiet cmake bzip2 flac xz pcre libzzip
- os: windows-latest
deps: choco install cmake --no-progress

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install Python dependencies
run: python -m pip install numpy>2

- name: Install system dependencies
run: ${{ matrix.deps }}

- name: Configure CMake
working-directory: cmake
run: cmake -B build -DBUILD_PYTHON=ON -DGD_TEST=ON

- name: Build
working-directory: cmake
run: cmake --build build --config Release

- name: Run tests
working-directory: cmake
run: ctest --test-dir build --output-on-failure --build-config Release --no-tests=error
90 changes: 31 additions & 59 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,51 +16,15 @@ jobs:
matrix:
include:
# macos-15-intel for x86_64 (min macOS 15.0), macos-14 for ARM (min macOS 14.0)
- os: macos-15-intel
python: '3.9'
build: 'cp39-macosx_x86_64'
target: '15.0'
prefix: /usr/local

- os: macos-15-intel
python: '3.10'
build: 'cp310-macosx_x86_64'
target: '15.0'
prefix: /usr/local

- os: macos-15-intel
python: '3.11'
build: 'cp311-macosx_x86_64'
target: '15.0'
prefix: /usr/local

- os: macos-15-intel
python: '3.12'
build: 'cp312-macosx_x86_64'
build: 'cp*-macosx_x86_64'
target: '15.0'
prefix: /usr/local

- os: macos-14
python: '3.9'
build: 'cp39-macosx_arm64'
target: '14.0'
prefix: /opt/homebrew

- os: macos-14
python: '3.10'
build: 'cp310-macosx_arm64'
target: '14.0'
prefix: /opt/homebrew

- os: macos-14
python: '3.11'
build: 'cp311-macosx_arm64'
target: '14.0'
prefix: /opt/homebrew

- os: macos-14
python: '3.12'
build: 'cp312-macosx_arm64'
build: 'cp*-macosx_arm64'
target: '14.0'
prefix: /opt/homebrew

Expand All @@ -69,6 +33,11 @@ jobs:
build: 'cp*-manylinux_x86_64'
prefix: /usr

- os: windows-latest
python: '3.12'
build: 'cp*-win_amd64'
prefix: 'C:\Program Files'

steps:
- name: Setup environment
run: echo "PREFIX=${{ matrix.prefix }}" >> $GITHUB_ENV
Expand All @@ -87,43 +56,46 @@ jobs:
- name: Setup macOS environment
if: runner.os == 'macOS'
run: |
brew install automake libtool
echo "MACOSX_DEPLOYMENT_TARGET=${{ matrix.target }}" >> $GITHUB_ENV
echo CPPFLAGS="`python3-config --includes`" >> $GITHUB_ENV

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.21.3
run: python -m pip install cibuildwheel==3.3.0

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse bindings/python
env:
CIBW_BUILD: ${{ matrix.build }}
CIBW_SKIP: cp36* cp37* cp38*
CIBW_SKIP: cp38*
CIBW_BEFORE_ALL_LINUX: >
yum install -y bzip2-devel flac-devel xz-devel pcre-devel zziplib-devel &&
.github/workflows/bootstrap.sh --disable-python &&
make
yum install -y cmake bzip2-devel flac-devel xz-devel pcre-devel zziplib-devel
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are all of these plugin libraries being found correctly by cmake? IIRC, I had to give hints to autotools with the bootstrap command to make sure that all of the. compression plugins built properly.

CIBW_BEFORE_ALL_MACOS: >
brew install bzip2 flac xz pcre libzzip &&
.github/workflows/bootstrap.sh --disable-python &&
make
brew install --quiet cmake bzip2 flac xz pcre libzzip
CIBW_BEFORE_ALL_WINDOWS: >
choco install cmake --no-progress
CIBW_BEFORE_BUILD: >
python -m pip install "numpy>=2.0" &&
.github/workflows/bootstrap.sh &&
make -C bindings/python pyconstants.c
CIBW_REPAIR_WHEEL_COMMAND_LINUX: >
LD_LIBRARY_PATH=$PWD/src/.libs auditwheel repair -w {dest_dir} {wheel}
CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
DYLD_LIBRARY_PATH=$PWD/src/.libs delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}
Comment on lines -114 to -117
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure these repair wheel command tweaks are not needed for linux and osx? IIRC I've had to set the library paths by hand like this for the repair tools to find the shared libraries and set RPATH correctly.

python -m pip install "scikit-build-core>=0.5" "numpy>=2.0"
CIBW_BEFORE_BUILD_WINDOWS: >
pip install delvewheel "scikit-build-core>=0.5" "numpy>=2.0"
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >
delvewheel repair --extract-dir {dest_dir}\..\extract --add-path {dest_dir}\..\extract\bin -vv -w {dest_dir} {wheel}
CIBW_BUILD_VERBOSITY: 1
CIBW_TEST_COMMAND: >
cd {package}/test &&
PYTHONPATH=`python -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])'`:$PYTHONPATH make check
CIBW_TEST_COMMAND_LINUX: >
python -c "import pygetdata; print(f'pygetdata version: {pygetdata.__version__}')" &&
cd {project}/bindings/python/test &&
python big_test.py
CIBW_TEST_COMMAND_MACOS: >
python -c "import pygetdata; print(f'pygetdata version: {pygetdata.__version__}')" &&
cd {project}/bindings/python/test &&
python big_test.py
CIBW_TEST_COMMAND_WINDOWS: >
python -c "import pygetdata; print(f'pygetdata version: {pygetdata.__version__}')" &&
cd /d {project}\bindings\python\test &&
python big_test.py

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: cibw-wheel-${{ matrix.os }}-${{ matrix.python }}
name: cibw-wheel-${{ matrix.os }}
path: ./wheelhouse/pygetdata*.whl

upload_pypi:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ libpath_mangled
Makefile
Makefile.in

CMakeFiles
CMakeCache.txt

/*.zip
/*.tar.*
/*.sig
Expand Down
2 changes: 0 additions & 2 deletions bindings/cxx/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
// along with GetData; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
#ifdef HAVE_CONFIG_H
#include "gd_config.h"
#endif

/* To avoid including stuff out of tree, we include everything here,
* even though getdata/dirfile.h will try to include it again.
Expand Down
2 changes: 0 additions & 2 deletions bindings/cxx/test/big_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
// along with GetData; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
#ifdef HAVE_CONFIG_H
#include "gd_config.h"
#endif
#undef GETDATA_LEGACY_API

#include "getdata/dirfile.h"
Expand Down
4 changes: 1 addition & 3 deletions bindings/idl/getdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
#undef _POSIX_C_SOURCE
#undef _SVID_SOURCE

#ifdef HAVE_CONFIG_H
# include "gd_config.h"
#endif
#include "gd_config.h"

#ifdef GD_EXTERNAL
# include <complex.h>
Expand Down
4 changes: 2 additions & 2 deletions bindings/make_parameters.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
* along with GetData; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifdef HAVE_CONFIG_H
#include "gd_config.h"
#endif

#include <stdlib.h>
#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif

#define GD_NO_LEGACY_API
#include "getdata.h"
Expand Down
2 changes: 0 additions & 2 deletions bindings/matlab/matlab.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

#ifdef HAVE_CONFIG_H
#include "gd_config.h"
#endif

#ifdef GD_EXTERNAL
# define GD_C89_API
Expand Down
17 changes: 12 additions & 5 deletions bindings/python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
[build-system]
requires = ["setuptools", "setuptools-scm", "wheel", "numpy>=2.0"]
build-backend = "setuptools.build_meta"
requires = ["scikit-build-core>=0.5", "numpy>=2.0", "setuptools-scm"]
build-backend = "scikit_build_core.build"

[project]
name = "pygetdata"
dependencies = ["numpy>=1.7"]
dynamic = ["version"]

[tool.setuptools]
script-files = ["../../util/dirfile2ascii", "../../util/checkdirfile"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These utilities are actually quite useful to include in the wheels if possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, halfway there. The wheels now

  • produce a python module that's dynamically linked,
  • include the corresponding .so/.dll, and
  • include whichever of these two utilities can be compiled on the platform.

Unfortunately, two limitations

  • dirfile2ascii uses getopt_long, which is unavailable on Windows, and
  • pyproject.toml only allows Python scripts to be installed (via [project.scripts]), so for these binaries to be visible in PATH, we'd need to create Python wrappers for them.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am losing all steam on making the windows build work, to be honest. I'd just turn the utils off on the windows build altogether. For the linux/osx builds, I think you can tell cmake to install binary files in the top level bin directory (something like install(<target> DESTINATION bin)) inside the wheel package, without any additional content in [project.scripts]. Does that work?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[tool.scikit-build]
cmake.source-dir = "../../cmake"
cmake.build-type = "Release"
cmake.args = ["-DBUILD_PYTHON=ON", "-DGD_TEST=OFF", "-DGD_UTIL=ON", "-DBUILD_CXX=OFF"]
wheel.install-dir = "."

[tool.scikit-build.metadata.version]
provider = "scikit_build_core.metadata.setuptools_scm"

[tool.setuptools_scm]
version_scheme = "only-version"
root = "../.."
version_scheme = "no-guess-dev"
local_scheme = "no-local-version"

1 change: 0 additions & 1 deletion bindings/python/setup.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ setup(
include_dirs = includes,
library_dirs = [ join(libbuild_dir, '.libs') ],
libraries = [ 'getdata' ],
define_macros = [ ('HAVE_CONFIG_H','1') ]
)
]
)
16 changes: 8 additions & 8 deletions bindings/python/test/big_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ def B(s):
def CheckOK(t):
global ne
ne+=1
print ("e[", t, "] =", sys.exc_info()[0], sys.exc_value)
print ("e[", t, "] =", sys.exc_info()[0], sys.exc_info()[1])

def CheckOK2(t,m):
global ne
ne+=1
print ("e[", t, ",", m, "] =", sys.exc_info()[0], sys.exc_value)
print ("e[", t, ",", m, "] =", sys.exc_info()[0], sys.exc_info()[1])

def CheckException(t,g):
global ne
Expand Down Expand Up @@ -88,7 +88,7 @@ def CheckSimple2(t,m,v,g):

def CheckEOS(t,v,g):
global ne
if (re.search(g + "$", v) == None):
if (re.search(re.escape(g) + "$", v) == None):
ne+=1
print ("n[", t, "] =", v, "expected", g)

Expand Down Expand Up @@ -641,7 +641,7 @@ def CheckEOS(t,v,g):
f = d.fragment(0)
except:
CheckOK(64)
CheckEOS(64,f.name,"dirfile/format")
CheckEOS(64,f.name,os.path.join("dirfile","format"))

# 65: nfragments check
try:
Expand Down Expand Up @@ -1053,7 +1053,7 @@ def CheckEOS(t,v,g):
n = d.raw_filename("data")
except:
CheckOK(116)
CheckEOS(116,n,"dirfile/data")
CheckEOS(116,n,os.path.join("dirfile","data"))

# 117: reference check
try:
Expand Down Expand Up @@ -1976,7 +1976,7 @@ def CheckEOS(t,v,g):
n = d.linterp_tablename("linterp")
except:
CheckOK(241)
CheckEOS(241,n,"dirfile/lut")
CheckEOS(241,n,os.path.join("dirfile","lut"))

# 242: mcarrays
try:
Expand Down Expand Up @@ -2247,9 +2247,9 @@ def CheckEOS(t,v,g):
# 305: gd_match_entries
try:
n = d.match_entries(regex='^lin', fragment=0)
CheckSimple2(305, 1, n, [ B('lincom'), B('linterp') ])
except:
CheckOK2(305, 0)
CheckSimple2(305, 1, n, [ B('lincom'), B('linterp') ])
CheckException2(305, 0, pygetdata.UnsupportedError) # Expected when regex unsupported

# 306: gd_open_limit
try:
Expand Down
Loading
Loading