-
-
Notifications
You must be signed in to change notification settings - Fork 104
cffi: Support using --system-zstd
#249
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
base: main
Are you sure you want to change the base?
Conversation
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.
This PR got bit rotted. I'm supportive of the change in functionality. If you rebase, I'll merge and get it in the next release.
Sure, will do that now. |
Move the CFFI-related logic from the global scope of `make_cffi.py` file to a `get_ffi()` function. This makes it possible to import the file without executing the code immediately, and it will make it possible to parametrize the invocation using explicit function parameters. Along with the change, I've renamed the variables to lowercase since they are no longer global. Signed-off-by: Michał Górny <[email protected]>
Support using the system zstd library with the CFFI backend. Use the GCC / Clang preprocessor output to find the paths to header files for preprocessing. Link to the system library, matching the behavior for the C backend. Signed-off-by: Michał Górny <[email protected]>
abfde12
to
5fd00c3
Compare
Rebased and updated. |
Hmm, I wonder what's different about zstd on macOS that it fails. Unfortunately, I don't have a macOS system to test. |
Wow - that was a quick rebase! The macOS failure looks legit. We'll need to figure out a path forward there. And I'm pressed for time today. I was planning to cut a release this weekend to help with 3.14 support. So we'll have to defer this to the next release. |
Yeah, no problem with that. As a last resort, I suppose we could limit system zstd + CFFI to Linux, I guess, and force CFFI with vendored libs elsewhere. |
Given that the CFFI code is much more fragile to library changes than the C extension code, use a separate `--system-zstd-cffi` switch to enable it. This should resolve the test failure on macOS. Signed-off-by: Michał Górny <[email protected]>
I went for the next best thing, I think: I've added a separate |
make_cffi.py
to avoid performing the compilation in global scope, and allow passing parameters--system-zstd
with the CFFI backend. This uses the C preprocessor to find the system headers for, well, further preprocessing.With these changes, I can successfully build the CFFI extension using system
zstd
library, and have it pass tests. I've also confirmed that it builds fine after removing thezstd
directory entirely.