Bug 533022

Summary: RFC: add /etc/rpm/macros.python to python-devel
Product: [Fedora] Fedora Reporter: Dave Malcolm <dmalcolm>
Component: pythonAssignee: Dave Malcolm <dmalcolm>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 12CC: a.badger, dmalcolm, ivazqueznet, james.antill, jonathansteffan, katzj
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-12-04 03:30:29 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Patch to add the macros.python file (needs new source file and %changelog entry) none

Description Dave Malcolm 2009-11-04 18:06:55 UTC
Proposal:
To add a file /etc/rpm/macros.python to the python-devel subpackage, containing these macros: 
%python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
%python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")

NB "__python" is defined in /usr/lib/rpm/macros as "/usr/bin/python"

This would avoid the need to define these macros in every specfile (assuming you had a recent enough python-devel).

I've tried doing something similar for python3-devel, see:
https://bugzilla.redhat.com/show_bug.cgi?id=526126#c43

One drawback is that the macro files are read (with rpmInitMacros) and
expanded on every rpm operation, which means that when python-devel is
installed, every "rpm" invocation is going to be quietly invoking
/usr/bin/python twice on startup.  None of the existing macro files seem to
invoke subprocess during expansion.

Comment 1 Dave Malcolm 2009-11-04 18:08:41 UTC
Created attachment 367514 [details]
Patch to add the macros.python file (needs new source file and %changelog entry)

Comment 2 Dave Malcolm 2009-11-04 18:11:25 UTC
Another way to do this would be to pre-evaluate the values, and bake them in to the macro file.  That would avoid invoking /usr/bin/python twice, but would make them not change if __python was redefined.

Comment 3 James Antill 2009-11-04 18:50:09 UTC
 The python3 macro names should be %python3_sitelib and %python3_sitearch otherwise people are going to get screwed over as the value changes at different points in the specfile (depending on what __python points to). You shouldn't consider the specfile language a real programming language, IMO.
 So just pre-populating them should be fine.

Comment 4 Bug Zapper 2009-11-16 15:05:57 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 12 development cycle.
Changing version to '12'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 5 Dave Malcolm 2010-01-22 22:30:06 UTC
Panu: am I right in thinking that these macros are supplied now in F-13's rpm?

Comment 6 Bug Zapper 2010-11-04 06:48:19 UTC
This message is a reminder that Fedora 12 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 12.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '12'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 12's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 12 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 7 Bug Zapper 2010-12-04 03:30:29 UTC
Fedora 12 changed to end-of-life (EOL) status on 2010-12-02. Fedora 12 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.