sdrnative 0.1.0__py3-none-win_amd64.whl

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.
sdrnative/__init__.py ADDED
@@ -0,0 +1,146 @@
1
+ # SDRNative
2
+ # Python package exports
3
+ #
4
+ # Copyright (c) 2026 Ruben Roy
5
+ # SPDX-License-Identifier: MPL-2.0
6
+
7
+
8
+ # start delvewheel patch
9
+ def _delvewheel_patch_1_13_2():
10
+ import ctypes
11
+ import os
12
+ import platform
13
+ import sys
14
+ libs_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, 'sdrnative.libs'))
15
+ is_conda_cpython = platform.python_implementation() == 'CPython' and (hasattr(ctypes.pythonapi, 'Anaconda_GetVersion') or 'packaged by conda-forge' in sys.version)
16
+ if sys.version_info[:2] >= (3, 8) and not is_conda_cpython or sys.version_info[:2] >= (3, 10):
17
+ if os.path.isdir(libs_dir):
18
+ os.add_dll_directory(libs_dir)
19
+ else:
20
+ load_order_filepath = os.path.join(libs_dir, '.load-order-sdrnative-0.1.0')
21
+ if os.path.isfile(load_order_filepath):
22
+ import ctypes.wintypes
23
+ with open(os.path.join(libs_dir, '.load-order-sdrnative-0.1.0'), encoding='utf-8') as file:
24
+ load_order = file.read().split()
25
+ kernel32 = ctypes.WinDLL('kernel32', use_last_error=True)
26
+ kernel32.LoadLibraryExW.restype = ctypes.wintypes.HMODULE
27
+ kernel32.LoadLibraryExW.argtypes = ctypes.wintypes.LPCWSTR, ctypes.wintypes.HANDLE, ctypes.wintypes.DWORD
28
+ for lib in load_order:
29
+ lib_path = os.path.join(os.path.join(libs_dir, lib))
30
+ if os.path.isfile(lib_path) and not kernel32.LoadLibraryExW(lib_path, None, 8):
31
+ raise OSError('Error loading {}; {}'.format(lib, ctypes.FormatError(ctypes.get_last_error())))
32
+
33
+
34
+ _delvewheel_patch_1_13_2()
35
+ del _delvewheel_patch_1_13_2
36
+ # end delvewheel patch
37
+
38
+ # Python binding !!
39
+
40
+ from ._native import (
41
+ ABIInfo,
42
+ Device,
43
+ DeviceInfo,
44
+ Capabilities,
45
+ FrequencyRange,
46
+ RateRange,
47
+ DeviceProfile,
48
+ TunerFamily,
49
+ DemodFamily,
50
+ tuner_family_name,
51
+ demod_family_name,
52
+ DVBTTuneInfo,
53
+ IQTuneInfo,
54
+ StreamInfo,
55
+ SignalQuality,
56
+ USBStats,
57
+ USBRecoveryStats,
58
+ AsyncOverflowPolicy,
59
+ AsyncConfig,
60
+ AsyncBlock,
61
+ AsyncStats,
62
+ AsyncStream,
63
+ ASYNC_MIN_TRANSFER_SIZE,
64
+ ASYNC_MAX_TRANSFER_SIZE,
65
+ ASYNC_MIN_TRANSFER_COUNT,
66
+ ASYNC_MAX_TRANSFER_COUNT,
67
+ ASYNC_MIN_QUEUE_DEPTH,
68
+ ASYNC_MAX_QUEUE_DEPTH,
69
+ ASYNC_MAX_QUEUE_BYTES,
70
+ ASYNC_MAX_TRANSFER_POOL_BYTES,
71
+ ASYNC_DEFAULT_TRANSFER_SIZE,
72
+ ASYNC_DEFAULT_TRANSFER_COUNT,
73
+ ASYNC_DEFAULT_QUEUE_DEPTH,
74
+ ASYNC_WAIT_INFINITE,
75
+ ErrorDomain,
76
+ ErrorFlags,
77
+ ErrorInfo,
78
+ SDRNativeError,
79
+ SDRNativeArgumentError,
80
+ SDRNativeStateError,
81
+ SDRNativeUSBError,
82
+ SDRNativeTunerError,
83
+ SDRNativeDemodError,
84
+ SDRNativeStreamError,
85
+ SDRNativeInternalError,
86
+ last_global_error_info,
87
+ native_library_path,
88
+ list_devices,
89
+ abi_info,
90
+ abi_version,
91
+ version,
92
+ )
93
+
94
+ __all__ = [
95
+ "ABIInfo",
96
+ "Device",
97
+ "DeviceInfo",
98
+ "Capabilities",
99
+ "FrequencyRange",
100
+ "RateRange",
101
+ "DeviceProfile",
102
+ "TunerFamily",
103
+ "DemodFamily",
104
+ "tuner_family_name",
105
+ "demod_family_name",
106
+ "DVBTTuneInfo",
107
+ "IQTuneInfo",
108
+ "StreamInfo",
109
+ "SignalQuality",
110
+ "USBStats",
111
+ "USBRecoveryStats",
112
+ "AsyncOverflowPolicy",
113
+ "AsyncConfig",
114
+ "AsyncBlock",
115
+ "AsyncStats",
116
+ "AsyncStream",
117
+ "ASYNC_MIN_TRANSFER_SIZE",
118
+ "ASYNC_MAX_TRANSFER_SIZE",
119
+ "ASYNC_MIN_TRANSFER_COUNT",
120
+ "ASYNC_MAX_TRANSFER_COUNT",
121
+ "ASYNC_MIN_QUEUE_DEPTH",
122
+ "ASYNC_MAX_QUEUE_DEPTH",
123
+ "ASYNC_MAX_QUEUE_BYTES",
124
+ "ASYNC_MAX_TRANSFER_POOL_BYTES",
125
+ "ASYNC_DEFAULT_TRANSFER_SIZE",
126
+ "ASYNC_DEFAULT_TRANSFER_COUNT",
127
+ "ASYNC_DEFAULT_QUEUE_DEPTH",
128
+ "ASYNC_WAIT_INFINITE",
129
+ "ErrorDomain",
130
+ "ErrorFlags",
131
+ "ErrorInfo",
132
+ "SDRNativeError",
133
+ "SDRNativeArgumentError",
134
+ "SDRNativeStateError",
135
+ "SDRNativeUSBError",
136
+ "SDRNativeTunerError",
137
+ "SDRNativeDemodError",
138
+ "SDRNativeStreamError",
139
+ "SDRNativeInternalError",
140
+ "last_global_error_info",
141
+ "native_library_path",
142
+ "list_devices",
143
+ "abi_info",
144
+ "abi_version",
145
+ "version",
146
+ ]
sdrnative/__main__.py ADDED
@@ -0,0 +1,33 @@
1
+ # SDRNative
2
+ # Python diagnostic entry point
3
+ #
4
+ # Copyright (c) 2026 Ruben Roy
5
+ # SPDX-License-Identifier: MPL-2.0
6
+
7
+ # diagnostic entry point for
8
+ # python -m sdrnative
9
+
10
+ from __future__ import annotations
11
+
12
+ from . import abi_version, list_devices, native_library_path, version
13
+
14
+
15
+ def main() -> int:
16
+ print(f"SDRNative runtime: {version()}")
17
+ print(f"C ABI: {abi_version()}")
18
+ print(f"Native library: {native_library_path()}")
19
+ try:
20
+ devices = list_devices()
21
+ except Exception as exc:
22
+ print(f"Device enumeration: ERROR: {exc}")
23
+ return 1
24
+
25
+ print(f"Devices: {len(devices)}")
26
+ for i, dev in enumerate(devices):
27
+ label = " ".join(part for part in (dev.manufacturer, dev.product, dev.serial) if part).strip()
28
+ print(f" [{i}] {label or 'RTL2832U device'} (VID:PID {dev.vid:04X}:{dev.pid:04X})")
29
+ return 0
30
+
31
+
32
+ if __name__ == "__main__":
33
+ raise SystemExit(main())