pact-python-ffi 0.4.28.2__tar.gz → 0.5.3.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,5 +1,4 @@
1
1
  src/pact_ffi/data
2
- src/pact_ffi/__version__.py
3
2
  src/pact_ffi/*.pyd
4
3
  src/pact_ffi/*.so
5
4
  src/pact_ffi/*.dylib
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pact-python-ffi
3
- Version: 0.4.28.2
3
+ Version: 0.5.3.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
@@ -1,7 +1,7 @@
1
1
  """
2
2
  Hatchling build hook.
3
3
 
4
- This hook is responsible for download the Pact FFI library and building the
4
+ This hook is responsible for downloading the Pact FFI library and building the
5
5
  CFFI bindings for it.
6
6
  """
7
7
 
@@ -15,12 +15,15 @@ import sys
15
15
  import tempfile
16
16
  import urllib.request
17
17
  from pathlib import Path
18
- from typing import Any
18
+ from typing import TYPE_CHECKING, Any
19
19
 
20
20
  import cffi
21
21
  from hatchling.builders.hooks.plugin.interface import BuildHookInterface
22
22
  from packaging.tags import sys_tags
23
23
 
24
+ if TYPE_CHECKING:
25
+ from collections.abc import Mapping, MutableMapping, Sequence
26
+
24
27
  PKG_DIR = Path(__file__).parent.resolve() / "src" / "pact_ffi"
25
28
  PACT_LIB_URL = "https://github.com/pact-foundation/pact-reference/releases/download/libpact_ffi-v{version}/{prefix}pact_ffi-{os}-{platform}{suffix}.{ext}"
26
29
 
@@ -56,7 +59,7 @@ class PactBuildHook(BuildHookInterface[Any]):
56
59
 
57
60
  PLUGIN_NAME = "pact-ffi"
58
61
 
59
- def __init__(self, *args: object, **kwargs: object) -> None:
62
+ def __init__(self, *args: Any, **kwargs: Any) -> None: # noqa: ANN401
60
63
  """
61
64
  Initialize the build hook.
62
65
 
@@ -73,7 +76,7 @@ class PactBuildHook(BuildHookInterface[Any]):
73
76
  """
74
77
  shutil.rmtree(self.tmpdir, ignore_errors=True)
75
78
 
76
- def clean(self, versions: list[str]) -> None: # noqa: ARG002
79
+ def clean(self, versions: Sequence[str]) -> None: # noqa: ARG002
77
80
  """
78
81
  Code called to clean.
79
82
 
@@ -93,7 +96,7 @@ class PactBuildHook(BuildHookInterface[Any]):
93
96
  def initialize(
94
97
  self,
95
98
  version: str, # noqa: ARG002
96
- build_data: dict[str, object],
99
+ build_data: MutableMapping[str, object],
97
100
  ) -> None:
98
101
  """
99
102
  Code called immediately before each build.
@@ -103,8 +106,8 @@ class PactBuildHook(BuildHookInterface[Any]):
103
106
  Not used (but required by the parent class).
104
107
 
105
108
  build_data:
106
- A dictionary to modify in-place used by Hatch when creating the
107
- final wheel.
109
+ A mutable mapping to modify in-place used by Hatch when creating
110
+ the final wheel.
108
111
 
109
112
  Raises:
110
113
  UnsupportedPlatformError:
@@ -122,6 +125,7 @@ class PactBuildHook(BuildHookInterface[Any]):
122
125
  except UnsupportedPlatformError as err:
123
126
  msg = f"Pact FFI library is not available for {err.platform}"
124
127
  self.app.display_error(msg)
128
+ raise
125
129
 
126
130
  self.app.display_debug(f"Wheel artefacts: {build_data['force_include']}")
127
131
  build_data["tag"] = self._infer_tag()
@@ -134,7 +138,7 @@ class PactBuildHook(BuildHookInterface[Any]):
134
138
  """
135
139
  return next(t.platform for t in sys_tags())
136
140
 
137
- def _install(self, version: str) -> dict[str, str]:
141
+ def _install(self, version: str) -> Mapping[str, str]:
138
142
  """
139
143
  Install the Pact library binary.
140
144
 
@@ -376,10 +380,10 @@ class PactBuildHook(BuildHookInterface[Any]):
376
380
  url:
377
381
  The URL to download
378
382
 
379
- Return:
383
+ Returns:
380
384
  The path to the downloaded artefact.
381
385
  """
382
- filename = url.split("/")[-1]
386
+ filename = url.rsplit("/", maxsplit=1)[-1]
383
387
  artefact = PKG_DIR / "data" / filename
384
388
  artefact.parent.mkdir(parents=True, exist_ok=True)
385
389
 
@@ -402,7 +406,7 @@ class PactBuildHook(BuildHookInterface[Any]):
402
406
  While the ABI3 interface was introduced in Python 3.2, we target the
403
407
  earliest supported version of Python in the Python wrapper.
404
408
 
405
- Return:
409
+ Returns:
406
410
  The tag for the current build.
407
411
  """
408
412
  python_version = f"{sys.version_info.major}{sys.version_info.minor}"