-
Notifications
You must be signed in to change notification settings - Fork 247
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
Allow to choose the build command #766
Comments
The idea has been mooted a few times! But generally we find other ways around the problem that don't require modifying the actual build. The actual build invocation seems pretty core to cibuildwheel, everything sorta leads up to that, so in the past we've been slightly resistant to adding a custom option. In this case it seems to me that the flexibility built into import sys, subprocess, os
# remove the postgres libs from path
path_elements = os.environ['PATH'].split(os.pathsep)
path_elements = [p for p in path_elements if '\\PostgreSQL\\' not in p]
os.environ['PATH'] = os.pathsep.join(path_elements)
subprocess.run(['delvewheel', *sys.argv[1:]], check=True) Then set CIBW_REPAIR_WHEEL_COMMAND to be It is a little hacky, but to me this feels more like an oddity in the repair process than the build, so better addressed at that stage? By the way, do you know why PATH is so crucial to delvewheel? Is that a lookup path for dynamic libraries on windows? |
Hi @joerick, I have solved the problem our side, adding the possibility of specifying which pg_config executable to use via a PG_CONFIG env var. I thought about hacking on the repair command backwards too but it feels much more brittle (there might be the need of a similar hack on the test command too, I don't know about the state of the PATH before my custom dir is added, etc.) Of course I could work around the problem this way only because I am in control of the upstream project to build. You may want to use my use case as a data point in the decision of whether to add build command configuration or not (I understand how that command might actually be not so easy to expose or to give it a stable interface) About why delvewheel is so sensitive to the PATH, I am not sure. I think that windows uses the PATH to find dynamic libraries and the github runner has dozens of directories on the path, including one containing another half-baked Postgres installation. I have just noticed something unexpected with the packages I just built: they have been packaged with the wrong libpq library (version 1300xx was expected). I will make a couple of test and let the delvewheel project know about anything interesting I may find. |
Aside: for a preview of the delvewheel horror story, on the CI runner there are:
|
N.B., FWIW |
This is my recommendation: https://scikit-hep.org/developer/gha_wheels (And the previous two pages). I'd be happy to have the docs in cibuildwheel look a bit more like a general version of that. :) |
Good point; based on that, for a custom command |
I don't see a strong need for this, and since PEP517 we're increasingly in a world where this shouldn't be necessary. So, for now at least, I'm gonna close this as a non-goal. |
Hello,
In #765 I am trying to fix the PATH in the build env to build a packages. The story is actually a bit more complicated than that: in order to build a working psycopg package (outside cibuildwheel), what seems needed (as can be seen in this test run) is:
python setup.py bdist_wheel
(or equivalent) withpg_config
in the path:If 1 and 2 run in the same environment, delvewheel will pull in something wrong, resulting in the error that can be seen in this run:
So, it looks like postgres includes, in its libs, a library built with MinGW which eclipses an equivalent library available in windows which delvewheel finds easy to digest. In a test I made on a local machine it does seem that
--no-mangle
works ok, so this is probably not a show-stopper.However:
I can see that there is an env var
CIBW_BUILD_FRONTEND
, which can be used to customise the build step, however it only allows a few precanned choices:build
andpip
. Wouldn't it be useful to allow also to BYOS (bring your own script) and allow the user to choose whatever command solves their problem? In my case I would have set:where
build_wheel.ps1
would contain just:The cibuildwheel pipeline can be already configured using
CIBW_REPAIR_WHEEL_COMMAND
andCIBW_TEST_COMMAND
: it feels natural to haveCIBW_BUILD_WHEEL_COMMAND
too.No? :)
Thank you!
The text was updated successfully, but these errors were encountered: