Back in August, the {__python} macro was deprecated in favor of {__python2}. This is cool as it paves the way for an eventual python3 takeover.
https://fedoraproject.org/w/index.php?title=Packaging:Python&diff=350838...
However, {__python} is still the expected macro for el6 builds. Many of us maintain single spec files that we build for Fedora and EPEL.
- Does anyone have any recommendations about how to handle this?
I recently started using this blurb at the top of my new spec files. Will it do?
%if 0%{?rhel} && 0%{?rhel} <= 6 %{!?__python2: %global __python2 %{__python}} %{!?python2_sitelib: %global python2_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} %{!?python2_sitearch: %global python2_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} %endif
- If we decide on a canonical approach, can it be added to the Python guidelines as a recommendation?
Cheers- -Ralph
On Wed, Dec 04, 2013 at 02:41:30PM -0500, Ralph Bean wrote:
Back in August, the {__python} macro was deprecated in favor of {__python2}. This is cool as it paves the way for an eventual python3 takeover.
https://fedoraproject.org/w/index.php?title=Packaging:Python&diff=350838...
However, {__python} is still the expected macro for el6 builds. Many of us maintain single spec files that we build for Fedora and EPEL.
- Does anyone have any recommendations about how to handle this?
Someone should take a look at the present guidelines but I think just using /usr/bin/python2 (or python2 and letting PATH do the rest) is probably okay.
I recently started using this blurb at the top of my new spec files. Will it do?
%if 0%{?rhel} && 0%{?rhel} <= 6 %{!?__python2: %global __python2 %{__python}} %{!?python2_sitelib: %global python2_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} %{!?python2_sitearch: %global python2_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} %endif
it's probably more correct to do this this way:
%if 0%{?rhel} && 0%{?rhel} <= 6 %{!?__python2: %global __python2 /usr/bin/python2} %{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} %{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} %endif
- If we decide on a canonical approach, can it be added to the Python guidelines as a recommendation?
Yeah, but please draft it up. I'm low on time so even completing writing of the changes for this approved guideline change hasn't been something I've gotten too: https://fedorahosted.org/fpc/ticket/327#comment:9
-Toshio
python-devel@lists.fedoraproject.org