From 4db0beb91ba3ace901b457b83daa6053971a9468 Mon Sep 17 00:00:00 2001 From: earonesty Date: Wed, 1 Nov 2023 13:19:19 -0700 Subject: [PATCH 1/3] Create hook-coincurve coincurve hooks, tested osx/linux/windows --- .../hooks/stdhooks/hook-coincurve | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-coincurve diff --git a/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-coincurve b/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-coincurve new file mode 100644 index 000000000..16b7f1ea1 --- /dev/null +++ b/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-coincurve @@ -0,0 +1,26 @@ +from PyInstaller.utils.hooks import collect_data_files, get_package_paths +import os +import re + +hiddenimports = ['_cffi_backend'] + +# Get the package path +package_path = get_package_paths('coincurve')[0] + +# Collect data files +datas = collect_data_files('coincurve') + +# Regular expression pattern for libsecp256k1 +libsecp256k1_pattern = re.compile(r'(libsecp256k1|_libsecp256k1).*\.(dll|so)') + +# Search for libsecp256k1 file within the 'coincurve' folder +coincurve_path = os.path.join(package_path, 'coincurve') +libsecp256k1_path = None +for root, _, files in os.walk(coincurve_path): + for file in files: + if libsecp256k1_pattern.search(file): + libsecp256k1_path = os.path.join(root, file) + datas.append((libsecp256k1_path, 'coincurve')) + break + + assert libsecp256k1_path, f"can't find coincurve libsecp256k1, look in {coincurve_path} and then modify this hook" From bd4d25195f79c1fc7d7ba918370ab5a48407d09c Mon Sep 17 00:00:00 2001 From: earonesty Date: Wed, 1 Nov 2023 13:21:28 -0700 Subject: [PATCH 2/3] Update hook-coincurve copyright --- .../hooks/stdhooks/hook-coincurve | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-coincurve b/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-coincurve index 16b7f1ea1..42b4d1b22 100644 --- a/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-coincurve +++ b/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-coincurve @@ -1,3 +1,15 @@ +# ------------------------------------------------------------------ +# Copyright (c) 2020 PyInstaller Development Team. +# +# This file is distributed under the terms of the GNU General Public +# License (version 2.0 or later). +# +# The full license is available in LICENSE.GPL.txt, distributed with +# this software. +# +# SPDX-License-Identifier: GPL-2.0-or-later +# ------------------------------------------------------------------ + from PyInstaller.utils.hooks import collect_data_files, get_package_paths import os import re From 498a3e216341f319d59862ec713477475602c5ea Mon Sep 17 00:00:00 2001 From: earonesty Date: Wed, 1 Nov 2023 13:22:32 -0700 Subject: [PATCH 3/3] Create 658.new.rst --- news/658.new.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/658.new.rst diff --git a/news/658.new.rst b/news/658.new.rst new file mode 100644 index 000000000..15048c571 --- /dev/null +++ b/news/658.new.rst @@ -0,0 +1 @@ +Add a hook for ``coincurve`` to collect data, binaries and hidden imports.