Mercurial > hg
changeset 43341:92a51a45d44c stable
packaging: be explicit about Python version in rpm spec
Fedora 31 has Python3 at /usr/bin/python ... but expect everybody to not just
find python in $PATH but be explicit about whether they want python2 or
python3. mercurial.spec just used 'python' and would fail when it unknowingly
used Python 3 and ended up with Mercurial setup.py reporting "Python 3.7
detected." and talking about the HGPYTHON3 environment variable.
For now, just be explicit about using system python2 as python executable when
building rpms.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Sun, 27 Oct 2019 21:40:21 +0100 |
parents | e0812b032bcc |
children | a6dcac6454c1 |
files | contrib/packaging/mercurial.spec |
diffstat | 1 files changed, 8 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/packaging/mercurial.spec Sun Oct 27 20:17:33 2019 +0100 +++ b/contrib/packaging/mercurial.spec Sun Oct 27 21:40:21 2019 +0100 @@ -15,7 +15,8 @@ %else -%global pythonver %(python -c 'import sys;print(".".join(map(str, sys.version_info[:2])))') +%global pythonexe python2 +%global pythonver %(%{pythonexe} -c 'import sys;print(".".join(map(str, sys.version_info[:2])))') %endif @@ -52,7 +53,7 @@ %if "%{?withpython}" %setup -q -n mercurial-%{version}-%{release} -a1 -a2 # despite the comments in cgi.py, we do this to prevent rpmdeps from picking /usr/local/bin/python up -sed -i '1c#! /usr/bin/env python' %{pythonname}/Lib/cgi.py +sed -i '1c#! /usr/bin/env %{pythonexe}' %{pythonname}/Lib/cgi.py %else %setup -q -n mercurial-%{version}-%{release} %endif @@ -82,9 +83,11 @@ %endif -make all +make all PYTHON=%{pythonexe} make -C contrib/chg +sed -i -e '1s|#!/usr/bin/env python$|#!/usr/bin/env %{pythonexe}|' contrib/hg-ssh + %install rm -rf $RPM_BUILD_ROOT @@ -101,14 +104,14 @@ LD_LIBRARY_PATH=$PYPATH $PYPATH/python setup.py install --root="$RPM_BUILD_ROOT" cd - -PATH=$PYPATH:$PATH LD_LIBRARY_PATH=$PYPATH make install DESTDIR=$RPM_BUILD_ROOT PREFIX=%{hgpyprefix} MANDIR=%{_mandir} +PATH=$PYPATH:$PATH LD_LIBRARY_PATH=$PYPATH make install PYTHON=%{pythonexe} DESTDIR=$RPM_BUILD_ROOT PREFIX=%{hgpyprefix} MANDIR=%{_mandir} mkdir -p $RPM_BUILD_ROOT%{_bindir} ( cd $RPM_BUILD_ROOT%{_bindir}/ && ln -s ../..%{hgpyprefix}/bin/hg . ) ( cd $RPM_BUILD_ROOT%{_bindir}/ && ln -s ../..%{hgpyprefix}/bin/python2.? %{pythonhg} ) %else -make install DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} MANDIR=%{_mandir} +make install PYTHON=%{pythonexe} DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} MANDIR=%{_mandir} %endif