osu-native-py 0.1.1__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.
- osu_native_py/__init__.py +11 -0
- osu_native_py/native/__init__.py +113 -0
- osu_native_py/native/bin/win-x64/osu.Native.dll +0 -0
- osu_native_py/native/bindings.py +1921 -0
- osu_native_py/wrapper/__init__.py +11 -0
- osu_native_py/wrapper/attributes/__init__.py +25 -0
- osu_native_py/wrapper/attributes/difficulty/__init__.py +15 -0
- osu_native_py/wrapper/attributes/difficulty/base.py +18 -0
- osu_native_py/wrapper/attributes/difficulty/catch.py +21 -0
- osu_native_py/wrapper/attributes/difficulty/mania.py +21 -0
- osu_native_py/wrapper/attributes/difficulty/osu.py +86 -0
- osu_native_py/wrapper/attributes/difficulty/taiko.py +48 -0
- osu_native_py/wrapper/attributes/performance/__init__.py +15 -0
- osu_native_py/wrapper/attributes/performance/base.py +14 -0
- osu_native_py/wrapper/attributes/performance/catch.py +18 -0
- osu_native_py/wrapper/attributes/performance/mania.py +24 -0
- osu_native_py/wrapper/attributes/performance/osu.py +64 -0
- osu_native_py/wrapper/attributes/performance/taiko.py +35 -0
- osu_native_py/wrapper/calculators/__init__.py +29 -0
- osu_native_py/wrapper/calculators/difficulty_calculator.py +202 -0
- osu_native_py/wrapper/calculators/performance_calculator.py +308 -0
- osu_native_py/wrapper/objects/__init__.py +17 -0
- osu_native_py/wrapper/objects/beatmap.py +141 -0
- osu_native_py/wrapper/objects/error_code.py +62 -0
- osu_native_py/wrapper/objects/mod.py +93 -0
- osu_native_py/wrapper/objects/mods_collection.py +109 -0
- osu_native_py/wrapper/objects/ruleset.py +83 -0
- osu_native_py/wrapper/objects/score_info.py +82 -0
- osu_native_py/wrapper/utils/__init__.py +9 -0
- osu_native_py/wrapper/utils/native_handler.py +91 -0
- osu_native_py/wrapper/utils/native_helper.py +47 -0
- osu_native_py-0.1.1.dist-info/METADATA +96 -0
- osu_native_py-0.1.1.dist-info/RECORD +35 -0
- osu_native_py-0.1.1.dist-info/WHEEL +4 -0
- osu_native_py-0.1.1.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import platform
|
|
5
|
+
import sys
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
if sys.platform == "win32":
|
|
9
|
+
LIB_NAME = "osu.Native.dll"
|
|
10
|
+
PLATFORM_DIR = "win-x64"
|
|
11
|
+
elif sys.platform == "darwin":
|
|
12
|
+
LIB_NAME = "osu.Native.dylib"
|
|
13
|
+
PLATFORM_DIR = "osx-arm64"
|
|
14
|
+
else:
|
|
15
|
+
LIB_NAME = "osu.Native.so"
|
|
16
|
+
_machine = platform.machine()
|
|
17
|
+
if _machine == "aarch64":
|
|
18
|
+
PLATFORM_DIR = "linux-arm64"
|
|
19
|
+
elif _machine.startswith("arm"):
|
|
20
|
+
PLATFORM_DIR = "linux-arm"
|
|
21
|
+
else:
|
|
22
|
+
PLATFORM_DIR = "linux-x64"
|
|
23
|
+
|
|
24
|
+
BIN_DIR = Path(__file__).parent / "bin" / PLATFORM_DIR
|
|
25
|
+
LIB_PATH = BIN_DIR / LIB_NAME
|
|
26
|
+
|
|
27
|
+
if not BIN_DIR.exists():
|
|
28
|
+
raise ImportError(
|
|
29
|
+
f"Native library directory not found: {BIN_DIR}\n"
|
|
30
|
+
f"Expected platform: {PLATFORM_DIR}\n"
|
|
31
|
+
f"This package requires platform-specific native libraries.",
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
if not LIB_PATH.exists():
|
|
35
|
+
raise ImportError(
|
|
36
|
+
f"Native library not found: {LIB_PATH}\n"
|
|
37
|
+
f"Expected library: {LIB_NAME}\n"
|
|
38
|
+
f"Available files in {BIN_DIR}: {list(BIN_DIR.iterdir()) if BIN_DIR.exists() else 'directory does not exist'}",
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
if sys.platform == "win32":
|
|
42
|
+
os.environ["PATH"] = str(BIN_DIR) + os.pathsep + os.environ.get("PATH", "")
|
|
43
|
+
try:
|
|
44
|
+
os.add_dll_directory(str(BIN_DIR)) # type: ignore[attr-defined]
|
|
45
|
+
except (AttributeError, OSError):
|
|
46
|
+
pass
|
|
47
|
+
elif sys.platform == "darwin":
|
|
48
|
+
os.environ["DYLD_LIBRARY_PATH"] = (
|
|
49
|
+
str(BIN_DIR) + os.pathsep + os.environ.get("DYLD_LIBRARY_PATH", "")
|
|
50
|
+
)
|
|
51
|
+
else:
|
|
52
|
+
os.environ["LD_LIBRARY_PATH"] = (
|
|
53
|
+
str(BIN_DIR) + os.pathsep + os.environ.get("LD_LIBRARY_PATH", "")
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
from . import bindings
|
|
57
|
+
|
|
58
|
+
ManagedObjectHandle = bindings.ManagedObjectHandle
|
|
59
|
+
|
|
60
|
+
NativeBeatmap = bindings.NativeBeatmap
|
|
61
|
+
NativeMod = bindings.NativeMod
|
|
62
|
+
NativeModsCollection = bindings.NativeModsCollection
|
|
63
|
+
NativeRuleset = bindings.NativeRuleset
|
|
64
|
+
NativeScoreInfo = bindings.NativeScoreInfo
|
|
65
|
+
|
|
66
|
+
NativeOsuDifficultyAttributes = bindings.NativeOsuDifficultyAttributes
|
|
67
|
+
NativeTaikoDifficultyAttributes = bindings.NativeTaikoDifficultyAttributes
|
|
68
|
+
NativeCatchDifficultyAttributes = bindings.NativeCatchDifficultyAttributes
|
|
69
|
+
NativeManiaDifficultyAttributes = bindings.NativeManiaDifficultyAttributes
|
|
70
|
+
|
|
71
|
+
NativeOsuPerformanceAttributes = bindings.NativeOsuPerformanceAttributes
|
|
72
|
+
NativeTaikoPerformanceAttributes = bindings.NativeTaikoPerformanceAttributes
|
|
73
|
+
NativeCatchPerformanceAttributes = bindings.NativeCatchPerformanceAttributes
|
|
74
|
+
NativeManiaPerformanceAttributes = bindings.NativeManiaPerformanceAttributes
|
|
75
|
+
|
|
76
|
+
NativeOsuDifficultyCalculator = bindings.NativeOsuDifficultyCalculator
|
|
77
|
+
NativeTaikoDifficultyCalculator = bindings.NativeTaikoDifficultyCalculator
|
|
78
|
+
NativeCatchDifficultyCalculator = bindings.NativeCatchDifficultyCalculator
|
|
79
|
+
NativeManiaDifficultyCalculator = bindings.NativeManiaDifficultyCalculator
|
|
80
|
+
|
|
81
|
+
NativeOsuPerformanceCalculator = bindings.NativeOsuPerformanceCalculator
|
|
82
|
+
NativeTaikoPerformanceCalculator = bindings.NativeTaikoPerformanceCalculator
|
|
83
|
+
NativeCatchPerformanceCalculator = bindings.NativeCatchPerformanceCalculator
|
|
84
|
+
NativeManiaPerformanceCalculator = bindings.NativeManiaPerformanceCalculator
|
|
85
|
+
|
|
86
|
+
__all__ = [
|
|
87
|
+
"LIB_NAME",
|
|
88
|
+
"PLATFORM_DIR",
|
|
89
|
+
"LIB_PATH",
|
|
90
|
+
"BIN_DIR",
|
|
91
|
+
"ManagedObjectHandle",
|
|
92
|
+
"NativeBeatmap",
|
|
93
|
+
"NativeMod",
|
|
94
|
+
"NativeModsCollection",
|
|
95
|
+
"NativeRuleset",
|
|
96
|
+
"NativeScoreInfo",
|
|
97
|
+
"NativeOsuDifficultyAttributes",
|
|
98
|
+
"NativeTaikoDifficultyAttributes",
|
|
99
|
+
"NativeCatchDifficultyAttributes",
|
|
100
|
+
"NativeManiaDifficultyAttributes",
|
|
101
|
+
"NativeOsuPerformanceAttributes",
|
|
102
|
+
"NativeTaikoPerformanceAttributes",
|
|
103
|
+
"NativeCatchPerformanceAttributes",
|
|
104
|
+
"NativeManiaPerformanceAttributes",
|
|
105
|
+
"NativeOsuDifficultyCalculator",
|
|
106
|
+
"NativeTaikoDifficultyCalculator",
|
|
107
|
+
"NativeCatchDifficultyCalculator",
|
|
108
|
+
"NativeManiaDifficultyCalculator",
|
|
109
|
+
"NativeOsuPerformanceCalculator",
|
|
110
|
+
"NativeTaikoPerformanceCalculator",
|
|
111
|
+
"NativeCatchPerformanceCalculator",
|
|
112
|
+
"NativeManiaPerformanceCalculator",
|
|
113
|
+
]
|
|
Binary file
|