I'm developing a python package that contains a C extension. I want to deploy a release for each operating system (linux, windows, macOS) using cibuildwheel. The C extension uses the arrayobject.h
header (from numpy). In order to use this header locally I set the enviroment variable C_INCLUDE_PATH
and I'm trying to do that in the builder action.
As I don't know "where" is that header in the cloud I find it using this command:
$(python -c 'import numpy, os; print(os.path.dirname(numpy.__file__))')/core/include/numpy
I've tried to set that enviroment variable using:
[tool.cibuildwheel]
environment = { C_INCLUDE_PATH="$(python -c 'import numpy, os; print(os.path.dirname(numpy.__file__))')/core/include/numpy" }
But it sais numpy is not installed, even when I've tried:
[tool.cibuildwheel]
before-build = [ "pip install numpy" ]
I'm aware that I should use the
build-system.requires
but that didn't work either.
It seems that enviroment variables are setted before all.
I know i can use the -I
flag and set the CFLAG
variable but I'm afraid this will end up in the same mistake (evaluating the variable before instaling numpy).
So, how can I include this path? Is a better way to do this that I'm missing?
Thanks.