On mar, 2024-04-23 at 11:32 +0000, Atri Bhattacharya wrote:
This came up during a fix towards making dlib builds reproducible: https://build.opensuse.org/request/show/1169495 but perhaps the issue with pyproject_wheel is more general.
If the user (packager) needs to pass options to `setup.py`, as in the case of dlib where it needs to be passed `--no USE_AVX_INSTRUCTIONS` for example, it seems there is no way to pass this from the %pyproject_wheel macro and we need to revert back to the older %python_build macro instead.
Actually, from my reading of the definitions in macros.python_all, specifically the snippet below:
%pyproject_wheel_args \\\ --verbose --progress-bar off --disable-pip-version-check \\\ %{?py_setup_args:--build-option %{py_setup_args}} \\\ --use-pep517 --no-build-isolation \\\ --no-deps \\\ --wheel-dir %{_pyproject_wheeldir}
it does seem one should be able to define the options as a macro called `py_setup_args` and they would be passed as part of the `--build-option`. However, in fact, the use of `--use-pep517` right after nullifies this — build-options are no longer passed, and I see a warning that says as much: "ignoring build-options because of --use-pep517" (I am paraphrasing).
I, therefore, have two questions, if someone may be kind enough to help me:
* Why allow a way to set --build-option in `%pyproject_wheel_args` if it is ignored due to `--use-pep517` anyway, and * Since --build-option cannot be set, is there a way to pass options to `setup.py` at all, or is it recommended that if such options are needed that we switch back to the older `%python_build` instead (as I did in the above sr)?
Looks like this issue was reported in python-rpm-macros project: https://github.com/openSUSE/python-rpm-macros/issues/165 As far as I know, in this specific case it's not possible to change the cmake arguments without calling setup.py directly, looks like it's looking for options in sys.argv directly [1], so it will never work with %pyproject_wheel. [1] https://github.com/davisking/dlib/blob/master/setup.py#L51