From e9f3ba8a7d683870759cdb85b2104b079d1a5281 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Tue, 6 Aug 2024 13:10:53 +0100 Subject: [PATCH] Added a PyInstaller hook for missing numpy file (#1083) * Added a PyInstaller hook for missing numpy file * Update numpy pyinstaller hook * Reformatted * Fix dst path * Reformatted --- amulet_map_editor/__pyinstaller/hook-numpy.py | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 amulet_map_editor/__pyinstaller/hook-numpy.py diff --git a/amulet_map_editor/__pyinstaller/hook-numpy.py b/amulet_map_editor/__pyinstaller/hook-numpy.py new file mode 100644 index 00000000..aaf669fa --- /dev/null +++ b/amulet_map_editor/__pyinstaller/hook-numpy.py @@ -0,0 +1,22 @@ +import os +import glob +import sys + +import numpy + +if sys.platform == "win32": + numpy_path = numpy.__path__[0] + numpy_lib_path = numpy_path + ".libs" + + datas = [ + (dll_path, "numpy.libs") + for dll_path in glob.glob(os.path.join(glob.escape(numpy_lib_path), "*.dll")) + ] + [ + ( + pyd_path, + os.path.relpath(os.path.dirname(pyd_path), os.path.dirname(numpy_path)), + ) + for pyd_path in glob.glob( + os.path.join(glob.escape(numpy.__path__[0]), "**", "*.pyd"), recursive=True + ) + ]