lore-vcs 0.8.3__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.
lore/__init__.py ADDED
@@ -0,0 +1,63 @@
1
+ """
2
+ Copyright Epic Games, Inc. All Rights Reserved.
3
+
4
+ Lore Python Bindings
5
+
6
+ Loads the Lore dll and parses it's header to provide acccess to Lore functionality
7
+ from pythons scripts
8
+ """
9
+
10
+ import platform
11
+ from pathlib import Path
12
+
13
+ from cffi import FFI
14
+
15
+
16
+ SYSTEM = platform.system().lower()
17
+ MACHINE = platform.machine().lower().replace("x86_64", "amd64")
18
+
19
+ WINDOWS_LIB_NAME = "lorelib-amd64-unknown-windows.dll"
20
+ DARWIN_LIB_NAME = "lorelib-arm64-apple-darwin.dylib"
21
+ LINUX_ARM_LIB_NAME = "lorelib-arm64-graviton-linux.so"
22
+ LINUX_X64_LIB_NAME = "lorelib-amd64-unknown-linux.so"
23
+
24
+
25
+ def _current_lib_name():
26
+ if SYSTEM == "linux":
27
+ if MACHINE in ("arm64", "aarch64"):
28
+ return LINUX_ARM_LIB_NAME
29
+ else:
30
+ return LINUX_X64_LIB_NAME
31
+ elif SYSTEM == "darwin":
32
+ return DARWIN_LIB_NAME
33
+ else:
34
+ return WINDOWS_LIB_NAME
35
+
36
+
37
+ def initialise():
38
+ """Loads lorelib shared library and initialises it for use"""
39
+ package_root = Path(__file__).resolve().parent
40
+
41
+ lib_name = _current_lib_name()
42
+ lib_file = package_root.joinpath("lib", lib_name)
43
+
44
+ inc_dir = package_root.joinpath("include")
45
+ inc_file = inc_dir.joinpath("lore.h")
46
+
47
+ with open(inc_file, "r", encoding="utf-8") as file:
48
+ lines = file.readlines()
49
+
50
+ contents = "".join(line for line in lines if not line.lstrip().startswith("#"))
51
+
52
+ loreffi = FFI()
53
+ loreffi.cdef(contents)
54
+ lore = loreffi.dlopen(str(lib_file))
55
+
56
+ return lore, loreffi
57
+
58
+
59
+ _lore, _loreffi = initialise()
60
+
61
+ # Re-export the fluent API entry points so users can do `from lore_py import Lore`.
62
+ # The low-level FFI wrappers remain accessible via `from lore_py.native import ...`.
63
+ from .fluent import Lore, LoreExecutor # noqa: E402