From c07c369a28c463796ef5e4e95c6a948980f5fe38 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Tue, 16 Aug 2022 17:26:57 -0300 Subject: [PATCH] add libtorrent pyinstaller hook --- scripts/hook-libtorrent.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 scripts/hook-libtorrent.py diff --git a/scripts/hook-libtorrent.py b/scripts/hook-libtorrent.py new file mode 100644 index 000000000..bd8b7da16 --- /dev/null +++ b/scripts/hook-libtorrent.py @@ -0,0 +1,24 @@ +""" +Hook for libtorrent. +""" + +import os +import glob +import os.path +from PyInstaller.utils.hooks import get_module_file_attribute +from PyInstaller import compat + + +def get_binaries(): + if compat.is_win: + files = ('c:/Windows/System32/libssl-1_1-x64.dll', 'c:/Windows/System32/libcrypto-1_1-x64.dll') + for file in files: + if not os.path.isfile(file): + print(f"MISSING {file}") + return [(file, '.') for file in files] + return [] + + +binaries = get_binaries() +for file in glob.glob(os.path.join(get_module_file_attribute('libtorrent'), 'libtorrent*pyd*')): + binaries.append((file, 'libtorrent'))