[Fedora-packaging] Python 3 compatibility update to Python guidelines

Ville Skyttä ville.skytta at iki.fi
Sat Oct 17 10:33:29 UTC 2009


https://fedoraproject.org/wiki/Packaging:Python

%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from 
distutils.sysconfig import get_python_lib; print get_python_lib()")}

%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from 
distutils.sysconfig import get_python_lib; print get_python_lib(1)")}


These no longer work with Python 3 due to "print" changes.  They should be 
replaced with something like these that work with both Python 2 and 3 (already 
done in spectemplate-python.spec in rpmdevtools git):

%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from 
distutils.sysconfig import *; import sys; 
sys.stdout.write(get_python_lib())")}

%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from 
distutils.sysconfig import *; import sys; 
sys.stdout.write(get_python_lib(1))")}




More information about the Fedora-packaging mailing list