Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
40 changes: 35 additions & 5 deletions .github/workflows/pr_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
if [ "${{ runner.os }}" = "macOS" ]; then
export MACOSX_DEPLOYMENT_TARGET="${{ matrix.os == 'macos-14' && 14 || 13.6 }}"
fi
cmake .. -DMEOS=ON -DCMAKE_BUILD_TYPE=Release \
cmake .. -DMEOS=ON -DCBUFFER=ON -DPOSE=ON -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${{ matrix.ld_prefix }}
make -j
sudo make install
Expand Down Expand Up @@ -98,11 +98,41 @@ jobs:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${{ matrix.ld_prefix }}/lib
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:${{ matrix.ld_prefix }}/lib
python -c "
import inspect
import pymeos_cffi
from pymeos_cffi import meos_initialize, meos_finalize
from pymeos_cffi import meos_initialize, meos_finalize, tstzspan_make
import pymeos_cffi.functions as f

# Shape-driven assertions, evaluated before any MEOS runtime state
# is initialised so a misbehaving wrapper cannot mask itself
# behind a crash inside meos_finalize.
assert callable(tstzspan_make), 'tstzspan_make missing'
assert callable(f.tpoint_as_mvtgeom), 'tpoint_as_mvtgeom missing'

# gsarr / timesarr were missing from the previous output_parameters
# set, which made them appear as user-facing list args; after the
# consolidation they are output parameters and must NOT appear in
# the wrapper's parameter list.
sig = inspect.signature(f.tpoint_as_mvtgeom)
for forbidden in ('gsarr', 'timesarr'):
assert forbidden not in sig.parameters, (
f'tpoint_as_mvtgeom unexpectedly takes {forbidden} as input'
)

# shape.nullable for meos_initialize.tz_str surfaces as a typed
# Optional in the wrapper; verify the annotation rather than
# calling because cycling through finalize() can hit known MEOS
# global-state quirks unrelated to the codegen.
ms_sig = inspect.signature(meos_initialize)
tz_param = ms_sig.parameters.get('tz_str')
assert tz_param is not None, 'meos_initialize lost tz_str arg'
assert 'None' in str(tz_param.annotation), (
f'tz_str annotation does not allow None: {tz_param.annotation}'
)

# Live initialisation check: just verify the standard happy-path
# cycle works on the configured timezone.
meos_initialize('UTC')
# Confirm a representative C function resolves
assert callable(pymeos_cffi.tstzspan_make), 'tstzspan_make missing'
meos_finalize()
print('PyMEOS CFFI build + smoke test OK on ${{ matrix.os }}')
print('PyMEOS CFFI build + shape smoke test OK on ${{ matrix.os }}')
"
5 changes: 4 additions & 1 deletion builder/build_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"meos_internal.h",
"meos_internal_geo.h",
"meos_npoint.h",
"meos_cbuffer.h",
"meos_pose.h",
"meos_rgeo.h",
]


Expand All @@ -24,7 +27,7 @@ def get_defined_functions(library_path):

def remove_undefined_functions(content, so_path):
defined = get_defined_functions(so_path)
undefined_types = ["json_object"]
undefined_types = ["json_object", "GEOSContextHandle_t"]

def remove_if_not_defined(m):
function = m.group(0).split("(")[0].strip().split(" ")[-1].strip("*")
Expand Down
3 changes: 3 additions & 0 deletions builder/build_pymeos.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"meos_internal.h",
"meos_internal_geo.h",
"meos_npoint.h",
"meos_cbuffer.h",
"meos_pose.h",
"meos_rgeo.h",
]

ffibuilder = FFI()
Expand Down
Loading