-
Notifications
You must be signed in to change notification settings - Fork 258
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
Add the ability to declare safe tools in a cross-build environment. #2317
Open
freakboy3742
wants to merge
7
commits into
pypa:main
Choose a base branch
from
freakboy3742:safe-tools
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a64a087
Add the ability to declare safe tools in a cross-build environment.
freakboy3742 471632e
Add an xfail if cmake isn't available on the test machine.
freakboy3742 598af3c
Placate linter regarding positional args.
freakboy3742 27af6e0
Rework test to provide more robust confirmation of safe tools.
freakboy3742 3f13cb5
Remove a test skip condition that is no longer needed.
freakboy3742 f7b60dd
Rename the setting to xbuild-tools.
freakboy3742 d2dcabb
Add docs to clarify that xbuild-tools is transitive.
freakboy3742 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1044,6 +1044,36 @@ Platform-specific environment variables are also available:<br/> | |
[PEP 517]: https://www.python.org/dev/peps/pep-0517/ | ||
[PEP 518]: https://www.python.org/dev/peps/pep-0517/ | ||
|
||
### `CIBW_XBUILD_TOOLS` {: #xbuild-tools} | ||
> Binaries on the path that should be included in an isolated cross-build environment. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (If we do specify a default, also list it here.) |
||
When building in a cross-platform environment, it is sometimes necessary to isolate the ``PATH`` so that binaries from the build machine don't accidentally get linked into the cross-platform binary. However, this isolation process will also hide tools that might be required to build your wheel. | ||
|
||
If there are binaries present on the `PATH` when you invoke cibuildwheel, and those binaries are required to build your wheels, those binaries can be explicitly included in the isolated cross-build environment using `CIBW_XBUILD_TOOLS`. The binaries listed in this setting will be linked into an isolated location, and that isolated location will be put on the `PATH` of the isolated environment. You do not need to provide the full path to the binary - only the executable name that would be found by the shell. | ||
|
||
If you declare a tool as a cross-build tool, and that tool cannot be found in the runtime environment, an error will be raised. | ||
|
||
*Any* tool used by the build process must be included in the `CIBW_XBUILD_TOOLS` list, not just tools that cibuildwheel will invoke directly. For example, if your build invokes `cmake`, and the `cmake` script invokes `magick` to perform some image transformations, both `cmake` and `magick` must be included in your safe tools list. | ||
|
||
Platform-specific environment variables are also available on platforms that use cross-platform environment isolation:<br/> | ||
`CIBW_XBUILD_TOOLS_IOS` | ||
|
||
#### Examples | ||
|
||
!!! tab examples "Environment variables" | ||
|
||
```yaml | ||
# Allow access to the cmake and rustc binaries in the isolated cross-build environment. | ||
CIBW_XBUILD_TOOLS: cmake rustc | ||
``` | ||
|
||
!!! tab examples "pyproject.toml" | ||
|
||
```toml | ||
[tool.cibuildwheel] | ||
# Allow access to the cmake and rustc binaries in the isolated cross-build environment. | ||
xbuild-tools = ["cmake", "rustc"] | ||
``` | ||
|
||
### `CIBW_REPAIR_WHEEL_COMMAND` {: #repair-wheel-command} | ||
> Execute a shell command to repair each built wheel | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
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.
(if we do set a default, this would be:)
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.
I'm seeing this a bit differently.
If it's been requested in the configuration, then fail, it's a default tool then continue. (this would probably mean the default list does not initialize safe-tools but rather extends it).