-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create hook-coincurve #659
base: master
Are you sure you want to change the base?
Conversation
coincurve hooks, tested osx/linux/windows
copyright
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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>
|
coincurve hooks, tested osx/linux/windows