Use proper python2 macros to fix building

Stop using deprecated python macros: https://fedoraproject.org/wiki/Packaging:Python
This commit is contained in:
Sebastian Kisela 2018-07-24 10:58:42 +02:00
parent 699dc07b7d
commit 05e7e33533

View File

@ -1,9 +1,9 @@
%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} %{!?python2_sitearch: %define python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python2_lib; print get_python2_lib(1)")}
Summary: Mercurial -- a distributed SCM Summary: Mercurial -- a distributed SCM
Name: mercurial Name: mercurial
Version: 4.4.2 Version: 4.4.2
Release: 5%{?dist} Release: 6%{?dist}
# Release: 1.rc1%{?dist} # Release: 1.rc1%{?dist}
@ -58,16 +58,18 @@ documentation.
%setup -q -n %{name}-%{upstreamversion} %setup -q -n %{name}-%{upstreamversion}
#%patch0 -p0 #%patch0 -p0
#%patch1 -p1 #%patch1 -p1
# Patch files to use python2 instead of (since lately) non existent python binary.
sed -i 's|python|python2|' %{_builddir}/%{name}-%{version}/Makefile %{_builddir}/%{name}-%{version}/doc/Makefile
%build %build
make all make all
%install %install
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
%{__python} setup.py install -O1 --root $RPM_BUILD_ROOT --prefix %{_prefix} --record=%{name}.files %{__python2} setup.py install -O1 --root $RPM_BUILD_ROOT --prefix %{_prefix} --record=%{name}.files
make install-doc DESTDIR=$RPM_BUILD_ROOT MANDIR=%{_mandir} make install-doc DESTDIR=$RPM_BUILD_ROOT MANDIR=%{_mandir}
grep -v -e 'hgk.py*' -e %{python_sitearch}/mercurial/ -e %{python_sitearch}/hgext/ < %{name}.files > %{name}-base.files grep -v -e 'hgk.py*' -e %{python2_sitearch}/mercurial/ -e %{python2_sitearch}/hgext/ < %{name}.files > %{name}-base.files
grep 'hgk.py*' < %{name}.files > %{name}-hgk.files grep 'hgk.py*' < %{name}.files > %{name}-hgk.files
install -D -m 755 contrib/hgk $RPM_BUILD_ROOT%{_libexecdir}/mercurial/hgk install -D -m 755 contrib/hgk $RPM_BUILD_ROOT%{_libexecdir}/mercurial/hgk
@ -115,8 +117,8 @@ cacerts = /etc/pki/tls/certs/ca-bundle.crt
EOF EOF
install -m 644 certs.rc $RPM_BUILD_ROOT/%{_sysconfdir}/mercurial/hgrc.d install -m 644 certs.rc $RPM_BUILD_ROOT/%{_sysconfdir}/mercurial/hgrc.d
mv $RPM_BUILD_ROOT%{python_sitearch}/mercurial/locale $RPM_BUILD_ROOT%{_datadir}/locale mv $RPM_BUILD_ROOT%{python2_sitearch}/mercurial/locale $RPM_BUILD_ROOT%{_datadir}/locale
rm -rf $RPM_BUILD_ROOT%{python_sitearch}/mercurial/locale rm -rf $RPM_BUILD_ROOT%{python2_sitearch}/mercurial/locale
%find_lang hg %find_lang hg
@ -134,8 +136,8 @@ grep -v locale %{name}-base.files > %{name}-base-filtered.files
%{_datadir}/zsh/site-functions/ %{_datadir}/zsh/site-functions/
%dir %{_sysconfdir}/mercurial %dir %{_sysconfdir}/mercurial
%dir %{_sysconfdir}/mercurial/hgrc.d %dir %{_sysconfdir}/mercurial/hgrc.d
%{python_sitearch}/mercurial %{python2_sitearch}/mercurial
%{python_sitearch}/hgext %{python2_sitearch}/hgext
%{_emacs_sitelispdir}/mercurial %{_emacs_sitelispdir}/mercurial
%{_emacs_sitestartdir}/*.el %{_emacs_sitestartdir}/*.el
@ -149,6 +151,9 @@ grep -v locale %{name}-base.files > %{name}-base-filtered.files
##cd tests && %{__python} run-tests.py ##cd tests && %{__python} run-tests.py
%changelog %changelog
* Tue Jul 24 2018 Sebastian Kisela <skisela@redhat.com> - 4.4.2-6
- Stop using deprecated python macros: https://fedoraproject.org/wiki/Packaging:Python
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 4.4.2-5 * Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 4.4.2-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild