pact-python-ffi 0.5.8.0__tar.gz → 0.5.10.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: pact-python-ffi
3
- Version: 0.5.8.0
3
+ Version: 0.5.10.0
4
4
  Summary: Python bindings for the Pact FFI library
5
5
  Project-URL: Bug Tracker, https://github.com/pact-foundation/pact-python/issues
6
6
  Project-URL: Changelog, https://github.com/pact-foundation/pact-python/blob/main/pact-python-ffi/CHANGELOG.md
@@ -21,13 +21,13 @@ Classifier: Operating System :: Microsoft :: Windows
21
21
  Classifier: Operating System :: POSIX :: Linux
22
22
  Classifier: Programming Language :: Python
23
23
  Classifier: Programming Language :: Python :: 3 :: Only
24
- Classifier: Programming Language :: Python :: 3.10
25
24
  Classifier: Programming Language :: Python :: 3.11
26
25
  Classifier: Programming Language :: Python :: 3.12
27
26
  Classifier: Programming Language :: Python :: 3.13
28
27
  Classifier: Programming Language :: Python :: 3.14
28
+ Classifier: Programming Language :: Python :: 3.15
29
29
  Classifier: Topic :: Software Development :: Testing
30
- Requires-Python: >=3.10
30
+ Requires-Python: >=3.11
31
31
  Requires-Dist: cffi~=2.0
32
32
  Description-Content-Type: text/markdown
33
33
 
@@ -386,37 +386,46 @@ class PactBuildHook(BuildHookInterface[Any]):
386
386
  """
387
387
  Patch the upstream header so that CFFI can compile it.
388
388
 
389
- The upstream `pact.h` emits the callback parameter of
390
- `pactffi_register_plugin_log_callback` as an opaque struct passed by
391
- value, which cannot be compiled. The Rust signature is
392
- `Option<extern "C" fn(...)>`, whose ABI is a nullable function pointer.
393
- See https://github.com/pact-foundation/pact-reference/issues/544.
389
+ The upstream `pact.h` emits the callback parameters of
390
+ `pactffi_register_plugin_log_callback` and
391
+ `pactffi_register_log_callback` as opaque structs passed by value, which
392
+ cannot be compiled. The Rust signatures are `Option<extern "C" fn(...)>`,
393
+ whose ABI is a nullable function pointer. See
394
+ https://github.com/pact-foundation/pact-reference/issues/544.
394
395
 
395
396
  Args:
396
397
  source:
397
398
  The contents of the upstream `pact.h`.
398
399
 
399
400
  Returns:
400
- The header contents with the callback declared as a function
401
- pointer.
401
+ The header contents with the callbacks declared as function
402
+ pointers.
402
403
  """
403
- opaque = "typedef struct Option_PluginLogCallback Option_PluginLogCallback;"
404
- if opaque not in source:
405
- return source
406
- self.app.display_debug("Patching Option_PluginLogCallback in pact.h")
407
- return source.replace(
408
- opaque,
409
- "typedef void (*PluginLogCallback)("
410
- "const char *plugin_instance_id, "
411
- "const char *test_run_id, "
412
- "const char *level, "
413
- "const char *target, "
414
- "const char *message);",
415
- ).replace(
416
- "void pactffi_register_plugin_log_callback("
417
- "struct Option_PluginLogCallback callback);",
418
- "void pactffi_register_plugin_log_callback(PluginLogCallback callback);",
419
- )
404
+ for callback, register, first_arg in (
405
+ (
406
+ "PluginLogCallback",
407
+ "pactffi_register_plugin_log_callback",
408
+ "plugin_instance_id",
409
+ ),
410
+ ("LogCallback", "pactffi_register_log_callback", "log_id"),
411
+ ):
412
+ opaque = f"typedef struct Option_{callback} Option_{callback};"
413
+ if opaque not in source:
414
+ continue
415
+ self.app.display_debug(f"Patching Option_{callback} in pact.h")
416
+ source = source.replace(
417
+ opaque,
418
+ f"typedef void (*{callback})("
419
+ f"const char *{first_arg}, "
420
+ "const char *test_run_id, "
421
+ "const char *level, "
422
+ "const char *target, "
423
+ "const char *message);",
424
+ ).replace(
425
+ f"void {register}(struct Option_{callback} callback);",
426
+ f"void {register}({callback} callback);",
427
+ )
428
+ return source
420
429
 
421
430
  def _download(self, url: str) -> Path:
422
431
  """