Skip to content

Commit 663af66

Browse files
authored
181 ant 1 (#182)
* #181 - Save point * #181 - Save point * #181 * #181
1 parent b815c57 commit 663af66

File tree

4 files changed

+29
-5
lines changed

4 files changed

+29
-5
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning].
77

88
## [Unreleased]
99

10+
## [0.3.3] - 2025-02-06
11+
12+
### Changed in 0.3.3
13+
14+
- On Darwin look for libSz.dylib as the Senzing lib
15+
1016
## [0.3.2] - 2025-01-28
1117

1218
### Changed in 0.3.2

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = senzing_core
3-
version = 0.3.2
3+
version = 0.3.3
44
author = senzing
55
author_email = support@senzing.com
66
description = Senzing Python SDK

src/senzing_core/_helpers.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from __future__ import annotations
1010

1111
import json
12-
import os
12+
import platform
1313
import sys
1414
import threading
1515
from contextlib import suppress
@@ -169,18 +169,28 @@ def wrapped_func(*args: P.args, **kwargs: P.kwargs) -> T: # pylint: disable=too
169169
# -----------------------------------------------------------------------------
170170
# Helpers for loading Senzing C library
171171
# -----------------------------------------------------------------------------
172-
def load_sz_library(lib: str = "") -> CDLL:
172+
def load_sz_library(lib: str = "", os: str = "") -> CDLL:
173173
"""
174174
Check the OS name and load the appropriate Senzing library.
175175
176176
:meta private:
177177
"""
178+
179+
system_name = os if os else platform.uname().system
180+
178181
try:
179-
if os.name == "nt":
182+
if system_name == "Linux":
183+
return cdll.LoadLibrary(lib if lib else "libSz.so")
184+
185+
if system_name == "Darwin":
186+
return cdll.LoadLibrary(lib if lib else "libSz.dylib")
187+
188+
if system_name == "Windows":
180189
win_path = find_library(lib if lib else "Sz")
181190
return cdll.LoadLibrary(win_path if win_path else "")
182191

183-
return cdll.LoadLibrary(lib if lib else "libSz.so")
192+
print(f"ERROR: {system_name} is an unsupported operating system, expected Linux, Darwin or Windows")
193+
raise sdk_exception(1)
184194
except OSError as err:
185195
# TODO Wording & links for V4
186196
print(

tests/helpers_test.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,14 @@ def test_load_sz_library_missing_lib() -> None:
8888
assert isinstance(actual, SzError)
8989

9090

91+
def test_load_sz_library_incorrect_os() -> None:
92+
"""# TODO"""
93+
os = "Android"
94+
with pytest.raises(SzError):
95+
actual = load_sz_library(os=os)
96+
assert isinstance(actual, SzError)
97+
98+
9199
# -----------------------------------------------------------------------------
92100
# _helpers schemas
93101
# -----------------------------------------------------------------------------

0 commit comments

Comments
 (0)