On 19. 08. 25 20:42, Michael J Gruber wrote:
Miro Hrončok venit, vidit, dixit 2025-08-19 17:09:13:
On 19. 08. 25 16:33, Carlos Rodriguez-Fernandez wrote:
So, basically, don't use the following macros but write the BuildRequires?

    %generate_buildrequires
    %pyproject_buildrequires

No, you MUST use them. But ideally use them after *some* setup.py is generated.

Well, it's easy to declare something as MUST, but really those macros
cannot be incorporated as part of some typical upstream build setups,
simply because they are no *commands* which you call (instead of an
upstream command). Not all packages involving python are python only.
Imagine a package which upstream builds like this:

- configure writes, among other things, version info
- make does - among other things - the following:
- - build a library
- - call setup.py to build the python part (which depends on the lib)
- - use sphinx autodoc on the built python modukes

Let me correct myself.

You MUST generate buildrequires by %pyproject_buildrequires IF you use %pyproject_wheel.

If you don't do that, because your upstream wraps a setup.py build(_ext) call in their autotools/cmake/meson script, then obviously this does not apply. Sorry for the confusion.

Note that your upstream's script invoking setup.py will very likely eventually break and that's not a Fedora-driven decision.

However, if you already ripped upstream's make scripts apart by calling %py3_build and %py3_install in the specfile, you need to replace that with %pyproject_ macros -- and you MUST use %pyproject_buildrequires IF you do so. In the most impossible case, use it with the -N option. I'm happy to explain how and why and if the documentation needs to be updated for this, we can work on that.

Now the pyproject macros come along:
- pyproject_buildrequires needs to be done before "%build", thus before
   configure, but it calls setup.py for dependency info before configure
   can set up what setup.py needs - note that compiled features typically
   are determined during the configure run
- autodoc needs the built py modules, but where are they when we patch
   out "setup.py build" and use pyproject_wheel instead?
etc.

Really, in all cases where I had packages like this, switching to
pyproject macros meant ripping apart a perfectly fine configure/make
based workflow (e.g. trimming the make all target, calling individual
targets manually, doing part of configure manually), making the spec
file more clumsy. Those workarounds feel like the opposite of future
proofing, which the switch to te macros should be/

I don't think those more complex build setups are catered for by the
macros.

No, indeed they are not. However, I don't think you *should* rip apart upstream build files and replace them by Fedora macros. However, witch each setuptools change, calling setup.py by a script wrapped by a make tool becomes more and more... wrong. So you might *need* to rip it apart anyway :(

IMHO is started around 2022 with https://github.com/pypa/setuptools/issues/3143 when perfectly fine configure/make scripts started building zipped Python eggs (which is a rather obscure and obsoleted format).

When `setup.py install` stops working (planed for October 2025 by the setuptools project), it will break make scripts calling it. But upstreams can probably replace that by a custom make install scriptlet that copies files around.

When `setup.py build` stops working, it will again break such scripts calling it. Fortunately, there is not a target date for that one (yet).

So, ripping apart a perfectly fine configure/make script is not necessary. But the devil is in the *perfectly fine* part.

Alsa, remember to always do the switch to savefiles last, beacuse it's
so easy to end up building less than before the switch, and savefiles
hides all changes to the lest of packaged files - the opposite of what
we expect packagers to do when we ask them be explicite in their files
sections.

%pyproject_save_files is optional.

And I was actually thinking about how to make it less dangerous.

E.g. if your %files section already listed Python submodules to be more explicit, how to write that to %pyproject_save_files.

------

Note that https://fedoraproject.org/wiki/Changes/DeprecateSetuppyMacros explicitly is about:

 - calling %py3_build in spec is deprecated and not allowed
 - calling %py3_install in spec is deprecated and not allowed
 - calling setup.py build in spec is deprecated and not allowed
 - calling setup.py install in spec is deprecated and not allowed

It does not say: Go and rip apart your upstream's Makefiles.

--
Miro Hrončok
--
Phone: +420777974800
Fedora Matrix: mhroncok

--
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to