Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 842534

Summary: distutils-r1.eclass: Recent changes are breaking packages I maintain in the sage-on-gentoo overlay
Product: Gentoo Linux Reporter: François Bissey <frp.bissey>
Component: EclassesAssignee: Python Gentoo Team <python>
Status: RESOLVED INVALID    
Severity: normal CC: frp.bissey, mgorny, sam
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description François Bissey 2022-05-04 05:03:29 UTC
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
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2022-05-04 07:20:03 UTC
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`.
Comment 2 François Bissey 2022-05-04 07:24:12 UTC
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.
Comment 3 François Bissey 2022-05-15 02:31:14 UTC
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.