Skip to content

Refactor Python wrapper so the sdist includes the core library code #530

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

Merged
merged 6 commits into from
Mar 23, 2023
Merged

Refactor Python wrapper so the sdist includes the core library code #530

merged 6 commits into from
Mar 23, 2023

Conversation

stumpylog
Copy link
Contributor

@stumpylog stumpylog commented Mar 17, 2023

This PR allows the sdist to include the core library code in the archive, instead of downloading the code at build time. This should be enough for Piwheels to build armv7 wheels, though I'm not positive, mostly due to the existence of zxing_add_package_stb.

The change uses symlinks to create the core directory and required zxing.cmake file in the wrapper folder, without copying the files from the parent at archive creation time. The MANIFEST.in then includes these files (and follows the symlinks properly) to create a self contained archive.

I've tested all the following:

@stumpylog stumpylog marked this pull request as ready for review March 17, 2023 15:02
Copy link
Collaborator

@axxel axxel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your effort to help with this, much appreciated.

endif()
else()
zxing_add_package(pybind11 pybind11 ${pybind11_git_repo} ${pybind11_git_rev})
endif()

# Check pybind helpers are availible
find_package(pybind11 CONFIG)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

find_package is automatically called inside zxing_add_package if BUILD_DEPENDENCIES is set to AUTO which happens in the toplevel CMakeLists.txt which is only available/evaluated if hasParent is true. So in the sdist case, the following line should do the trick if added near line 16 above: set(BUILD_DEPENDENCIES "AUTO").

With that in-place one single zxing_add_package call and no extra find_package should hopefully work for all use cases. Could you please check if I'm correct with this assessment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll have to have a look. I recall this was a workaround for a Windows build failure, when it couldn't locate pybind. Will check if your suggestion helps

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worked great with that change across all the platforms. There's a single zxing_add_package now for finding pybind11

@@ -4,5 +4,6 @@ requires = [
"setuptools_scm",
"wheel",
"cmake>=3.14",
"pybind11[global]>=2.10.4",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • This line would force the presence of the pybind11 module (to be later found via find_package) right?
  • What does the [global] do?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • I believe it was the Windows build which couldn't find pybind11, even with this change and spawned the extra find package above
  • Docs here. It's use here in the pyproject.toml build system is how it's meant to be used. Without it, all the systems failed to locate pybind11 when build (not just windows)

@axxel axxel merged commit 8294f4c into zxing-cpp:master Mar 23, 2023
axxel added a commit that referenced this pull request Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy