Specifically https://github.com/gentoo/gentoo/commit/ac1735e34dad0a1f96543daa3d7ceb303b78d842 replace the call `setup.py build` by `setup.py build_ext`. As explained in https://github.com/cschwan/sage-on-gentoo/issues/693 the sage package autogenerate code during the `build` call that is then used during the `build_ext` call. Calling `build_ext` directly means that code is never built and results in build failure because autogenerated cython files are not found. Is there fundamental reason why calling `build` is bad? If that's the case I could push for a behavior change upstream. If not that is definitely a bug Gentoo side. Reproducible: Always
The purpose of the `build` command is only to run a bunch of sub-commands: https://github.com/pypa/distutils/blob/main/distutils/command/build.py#L129 If upstream needs to add custom logic, they should be modifying the appropriate subcommands, e.g. `build_ext` rather than injecting additional steps into `build` and expecting them to be executed. You can think of it like the `all` target in Makefile. If your subtargets require extra logic, you add the appropriate logic or dependencies into the subtargets, not into `all`.
If only python build system were half as well thought as makefile (and I am not saying they are the pinnacle of perfection) I/we wouldn't have those kinds of trouble. Thanks for the advice, I'll try to get upstream on board with a solution.
I got upstream to accept some changes (that ultimately I wrote). It is beneficial to them as well as it simplify the build system and remove some duplication that existed previously.