My PEX includes a Python package that is only avai...
# general
f
My PEX includes a Python package that is only available as an source distribution. I want to influence the build process of the sdist via setting the CMAKE_ARGS environment variable. I tried to export CMAKE_ARGS in the shell used to run Pants which didn't have any effect. I tried to use the "env" kwarg in the pex_binary target, but the values are only applied when the PEX is run (as I expected). I found the python-native-code flags in the docs, but they only allow setting CPPFLAGS and LDFLAGS. Eventually, I tried adding the CMAKE_ARGS via --subprocess-environment-env-vars option (in combination with --no-local-cache) which had no effect either. Do you have any idea what else I could try?
The sdist package uses
scikit-build-core
as a build backend. Apparently it's also possible to pass corresponding
--config-settings
to pip install, instead of using the
CMAKE_ARGS
env variable: https://github.com/orgs/scikit-build/discussions/815#discussioncomment-4359866 I also tried "repackaging" the sdist as a wheel using a
python_distribution
target, but as far as I understand, this would require pulling in the source code of the package. What I want instead is for
pex_binary
to forward the
--config-settings
(or a corresponding
CMAKE_ARGS
env var) to the `pip install`call.
c
By default, Pants will not forward envvars as part of making hermetic builds.
--subprocess-environment-env-vars
should work for that. I find the syntax is easier to get right if you're setting it in the pants.toml file. You can crack into everything Pants is doing with the
--keep-sandboxes=always
flag, which will keep the sandboxes around. you can at least see if your envvars are making it in.
👍 1