Open
Conversation
coincurve hooks, tested osx/linux/windows
copyright
rokm
requested changes
Nov 1, 2023
Member
rokm
left a comment
There was a problem hiding this comment.
Please also add a basic import test here, and add coincurve==18.0.0 to requirements-test-libraries.txt so that CI will run the added test.
| package_path = get_package_paths('coincurve')[0] | ||
|
|
||
| # Collect data files | ||
| datas = collect_data_files('coincurve') |
Member
There was a problem hiding this comment.
What data files are there to collect?
| datas.append((libsecp256k1_path, 'coincurve')) | ||
| break | ||
|
|
||
| assert libsecp256k1_path, f"can't find coincurve libsecp256k1, look in {coincurve_path} and then modify this hook" |
Member
There was a problem hiding this comment.
Any reason this is not using binaries = collect_dynamic_libs('coincurve')? This should pick up the DLL on Windows.
On linux and macOS, _libsecp256k1 seems to be an extension and should be picked up automatically.
Author
|
I wasn't aware of that function should probably work just fine I would need
to test it
I've never submitted a hook just getting stuff to work that's all
…On Wed, Nov 1, 2023, 5:27 PM Rok Mandeljc ***@***.***> wrote:
***@***.**** requested changes on this pull request.
Please also add a basic import test here
<https://github.com/pyinstaller/pyinstaller-hooks-contrib/blob/master/src/_pyinstaller_hooks_contrib/tests/test_libraries.py>,
and add coincurve==18.0.0 to requirements-test-libraries.txt
<https://github.com/pyinstaller/pyinstaller-hooks-contrib/blob/master/requirements-test-libraries.txt>
so that CI will run the added test.
------------------------------
In src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-coincurve
<#659 (comment)>
:
> +# 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
+
+hiddenimports = ['_cffi_backend']
+
+# Get the package path
+package_path = get_package_paths('coincurve')[0]
+
+# Collect data files
+datas = collect_data_files('coincurve')
What data files are there to collect?
------------------------------
In src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-coincurve
<#659 (comment)>
:
> +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"
Any reason this is not using binaries = collect_dynamic_libs('coincurve')?
This should pick up the DLL on Windows.
On linux and macOS, _libsecp256k1 seems to be an extension and should be
picked up automatically.
—
Reply to this email directly, view it on GitHub
<#659 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAMMUN3B7GOR6FP7ZCQ4X3YCK5FZAVCNFSM6AAAAAA6Z2VOTCVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTOMBZGEYDEOBZGM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***
com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
coincurve hooks, tested osx/linux/windows