Discussion: Macros for Python Specfiles

Nick Coghlan ncoghlan at redhat.com
Tue May 7 03:57:01 UTC 2013

On 05/06/2013 10:43 PM, Bohuslav Kabrda wrote:
> Hi all,
> as mentioned in [1], I'd like to start a discussion about proposed Python macros.
> The full macro file can be seen at [2] and an example diff of converted spec at [3].
> The important macros from the proposal are:
> %py_default_filter # will filter all *.so file provides from /usr/lib{64}/pythonX.Y/site-packages
> %py[3]_build # will run setup.py build with proper args/flags
> %py[3]_install # will run setup.py install with proper args
> I already proposed this to fpc [4], but it seems that there is a disagreement [5] about the %py_{build,install} macros. This is why I'd like to start a broader discussion about them here.
> Thank you for your opinions.

The potential advantage I see to the py_build and py_install macros is 
that we're actively trying to move away from always relying on setup.py 
upstream. Thus, the idea of a helper script that calls setup.py if it is 
present, or looks up the right build command in pymeta.cfg if *that* is 
present sounds reasonable to me.

Similarly, we're going to try to move away from invoking setup.py at 
install time, and instead install from wheel files with a post-install 
hook registered in the package metadata.

This will hopefully become clearer once I finish the next draft of PEP 
426 (Python's distribution metadata 2.0). You can get a sneak peek at 
https://bitbucket.org/ncoghlan/misc/src/default/pep-0426.txt, but be 
aware that that is a *very* rough draft (I'm in the middle of a major 
rewrite, after we realised the old metadata was fundamentally broken and 
not useful to anyone. I still have a *ton* of stuff to do in terms of 
clearly defining the bidirectional mapping between legacy metadata and 
metadata 2.0, adding the post install hook specification, etc).

The two parts likely to be of most interest to those on this list:

Development activities: 


Nick Coghlan
Red Hat Infrastructure Engineering & Development, Brisbane

Test Automation Team Lead
Beaker Development Lead (http://beaker-project.org/)
PulpDist Development Lead (http://pulpdist.readthedocs.org)

More information about the python-devel mailing list