jasonisnthappy 0.1.0__py3-none-manylinux2014_x86_64.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.
- jasonisnthappy/__init__.py +8 -0
- jasonisnthappy/database.py +1901 -0
- jasonisnthappy/libjasonisnthappy.so +0 -0
- jasonisnthappy/loader.py +63 -0
- jasonisnthappy-0.1.0.dist-info/METADATA +10 -0
- jasonisnthappy-0.1.0.dist-info/RECORD +8 -0
- jasonisnthappy-0.1.0.dist-info/WHEEL +5 -0
- jasonisnthappy-0.1.0.dist-info/top_level.txt +1 -0
|
Binary file
|
jasonisnthappy/loader.py
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Loader for jasonisnthappy native library.
|
|
3
|
+
The library should be downloaded during pip install.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import os
|
|
7
|
+
import platform
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
from typing import Optional
|
|
10
|
+
|
|
11
|
+
_lib_path: Optional[str] = None
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_platform_info():
|
|
15
|
+
"""Detect platform and return library information."""
|
|
16
|
+
system = platform.system()
|
|
17
|
+
machine = platform.machine().lower()
|
|
18
|
+
|
|
19
|
+
if system == "Darwin": # macOS
|
|
20
|
+
if machine == "arm64":
|
|
21
|
+
return {"dir": "darwin-arm64", "dest": "libjasonisnthappy.dylib"}
|
|
22
|
+
elif machine in ("x86_64", "amd64"):
|
|
23
|
+
return {"dir": "darwin-amd64", "dest": "libjasonisnthappy.dylib"}
|
|
24
|
+
elif system == "Linux":
|
|
25
|
+
if machine in ("aarch64", "arm64"):
|
|
26
|
+
return {"dir": "linux-arm64", "dest": "libjasonisnthappy.so"}
|
|
27
|
+
elif machine in ("x86_64", "amd64"):
|
|
28
|
+
return {"dir": "linux-amd64", "dest": "libjasonisnthappy.so"}
|
|
29
|
+
elif system == "Windows":
|
|
30
|
+
if machine in ("x86_64", "amd64"):
|
|
31
|
+
return {"dir": "windows-amd64", "dest": "jasonisnthappy.dll"}
|
|
32
|
+
|
|
33
|
+
return None
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def get_library_path() -> str:
|
|
37
|
+
"""Get the path to the native library. Raises if not found."""
|
|
38
|
+
global _lib_path
|
|
39
|
+
|
|
40
|
+
if _lib_path is not None:
|
|
41
|
+
return _lib_path
|
|
42
|
+
|
|
43
|
+
platform_info = _get_platform_info()
|
|
44
|
+
if platform_info is None:
|
|
45
|
+
raise RuntimeError(
|
|
46
|
+
f"Unsupported platform: {platform.system()}/{platform.machine()}\n"
|
|
47
|
+
f"Supported platforms: macOS (x64, arm64), Linux (x64, arm64), Windows (x64)"
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
# Check in package lib directory
|
|
51
|
+
lib_path = Path(__file__).parent / "lib" / platform_info["dir"] / platform_info["dest"]
|
|
52
|
+
|
|
53
|
+
if not lib_path.exists():
|
|
54
|
+
raise RuntimeError(
|
|
55
|
+
f"Native library not found at {lib_path}\n\n"
|
|
56
|
+
f"The library should have been downloaded during 'pip install'.\n"
|
|
57
|
+
f"Try reinstalling: pip uninstall jasonisnthappy && pip install jasonisnthappy\n\n"
|
|
58
|
+
f"Or manually download from:\n"
|
|
59
|
+
f"https://github.com/sohzm/jasonisnthappy/releases/latest"
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
_lib_path = str(lib_path)
|
|
63
|
+
return _lib_path
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
jasonisnthappy/__init__.py,sha256=EZqHrQ2NK5tb1mIAeCk8QSmFCYxLurQQU-I9uHPK_vQ,266
|
|
2
|
+
jasonisnthappy/database.py,sha256=g_aoa210ce6jaNb-FsXaARd5E0Fz4gCn6Yo6Vbe3EIE,65620
|
|
3
|
+
jasonisnthappy/libjasonisnthappy.so,sha256=pn-vOQFP4I_KSBoWibPuw5O-J2jDABg5rovOuwdp-g0,1034568
|
|
4
|
+
jasonisnthappy/loader.py,sha256=SghCXKU9iuez9gwXl831sn0wFU1LfmLbKlIinLmm-Q0,2128
|
|
5
|
+
jasonisnthappy-0.1.0.dist-info/METADATA,sha256=QpFqyNZN6Sn0hyHdsj099OwQIxKld0b9ntYA9QhFmUo,139
|
|
6
|
+
jasonisnthappy-0.1.0.dist-info/WHEEL,sha256=Ni0BvNMjgM0levNVLVxStkkkhfqApKrzwW4Lfxompu8,109
|
|
7
|
+
jasonisnthappy-0.1.0.dist-info/top_level.txt,sha256=qcswwJiUzQCM8BF6LjZw2z11PeOYPEBq0JaZcYBbaWU,15
|
|
8
|
+
jasonisnthappy-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
jasonisnthappy
|