Skip to content

Commit 1e00391

Browse files
committed
Supporting ARM64 (v4.0.0.1)
1 parent 46fe8ca commit 1e00391

File tree

7 files changed

+23
-26
lines changed

7 files changed

+23
-26
lines changed

PyPI/Package/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "webui2"
7-
version = "2.4.0.0"
7+
version = "2.4.0.1"
88
authors = [
99
{ name="Hassan Draga" },
1010
]
@@ -28,4 +28,4 @@ include-package-data = true
2828
where = ["src"]
2929

3030
[tool.setuptools.package-data]
31-
webui = ["webui-windows-msvc-x64/*", "webui-linux-gcc-x64/*", "webui-macos-clang-x64/*"]
31+
webui = ["webui-windows-msvc-x64/*", "webui-linux-gcc-x64/*", "webui-macos-clang-x64/*", "webui-windows-msvc-arm64/*", "webui-linux-gcc-arm64/*", "webui-macos-clang-arm64/*"]
239 KB
Binary file not shown.
-8 Bytes
Binary file not shown.
194 KB
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

PyPI/Package/src/webui/webui.py

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -279,37 +279,34 @@ def run(self, script):
279279
ctypes.c_char_p(script.encode('utf-8')))
280280

281281

282+
def _get_architecture() -> str:
283+
arch = platform.machine()
284+
if arch in ['x86_64', 'AMD64', 'amd64']:
285+
return 'x64'
286+
elif arch in ['aarch64', 'ARM64', 'arm', 'arm64']:
287+
return 'arm64'
288+
else:
289+
return arch
290+
291+
282292
def _get_library_path() -> str:
283293
global webui_path
294+
arch = _get_architecture()
284295
if platform.system() == 'Darwin':
285-
file = '/webui-macos-clang-x64/webui-2.dyn'
286-
path = os.getcwd() + file
287-
if os.path.exists(path):
288-
return path
289-
path = webui_path + file
290-
if os.path.exists(path):
291-
return path
292-
return path
296+
file = f'/webui-macos-clang-{arch}/webui-2.dylib'
293297
elif platform.system() == 'Windows':
294-
file = '\\webui-windows-msvc-x64\\webui-2.dll'
295-
path = os.getcwd() + file
296-
if os.path.exists(path):
297-
return path
298-
path = webui_path + file
299-
if os.path.exists(path):
300-
return path
301-
return path
298+
file = f'\\webui-windows-msvc-{arch}\\webui-2.dll'
302299
elif platform.system() == 'Linux':
303-
file = '/webui-linux-gcc-x64/webui-2.so'
304-
path = os.getcwd() + file
305-
if os.path.exists(path):
306-
return path
307-
path = webui_path + file
308-
if os.path.exists(path):
309-
return path
310-
return path
300+
file = f'/webui-linux-gcc-{arch}/webui-2.so'
311301
else:
312302
return ""
303+
path = os.getcwd() + file
304+
if os.path.exists(path):
305+
return path
306+
path = webui_path + file
307+
if os.path.exists(path):
308+
return path
309+
return path
313310

314311

315312
# Load webui_lib Dynamic Library

0 commit comments

Comments
 (0)