Accepting request 175857 from devel:languages:python

- Fix update-alternatives and support upgrade from previous versions

- Fix update-alternatives and support upgrade from previous versions

OBS-URL: https://build.opensuse.org/request/show/175857
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-Sphinx?expand=0&rev=18
This commit is contained in:
Stephan Kulow 2013-05-16 14:18:50 +00:00 committed by Git OBS Bridge
commit f450e03e6a
4 changed files with 51 additions and 11 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Thu May 16 10:33:17 UTC 2013 - speilicke@suse.com
- Fix update-alternatives and support upgrade from previous versions
-------------------------------------------------------------------
Tue Apr 30 14:38:24 UTC 2013 - speilicke@suse.com

View File

@ -80,6 +80,9 @@ and translating suite, the Docutils.
%prep
%setup -q -n Sphinx-%{version}
sed -i '/#\!/d' sphinx/pycode/pgen2/token.py # Fix non-excutable-script warning
# Add Interpreter version suffix to entrypoints (and thus /usr/bin binaries) to
# allow for update-alternatives later on:
sed -i 's/\(sphinx-.*\) =/\1-%{py_ver} =/' setup.py
%build
python setup.py build
@ -89,22 +92,34 @@ python setup.py build_sphinx -b man
%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
for B in apidoc autogen build quickstart ; do
mv %{buildroot}%{_bindir}/sphinx-$B %{buildroot}%{_bindir}/sphinx-$B-%{py_ver}
touch %{buildroot}%{_bindir}/sphinx-$B
ln -s %{_bindir}/sphinx-$B-%{py_ver} %{buildroot}%{_bindir}/sphinx-$B
done
install -d %{buildroot}%{_mandir}/man1/
for M in all apidoc build quickstart ; do
install -m 644 build/sphinx/man/sphinx-$M.1 %{buildroot}%{_mandir}/man1/sphinx-$M-%{py_ver}.1
touch %{buildroot}%{_mandir}/man1/sphinx-$M.1
ln -s %{_mandir}/man1/sphinx-$M-%{py_ver}.1 %{buildroot}%{_mandir}/man1/sphinx-$M.1
done
%find_lang sphinx
%check
nosetests
%pre
# Since /usr/bin/sphinx-* became ghosted to be used with update-alternatives, we have
# to get rid of the old binary resulting from the non-update-alternativies-ified package:
[[ ! -L %{_bindir}/sphinx-apidoc ]] && rm -f %{_bindir}/sphinx-apidoc
[[ ! -L %{_bindir}/sphinx-build ]] && rm -f %{_bindir}/sphinx-build
[[ ! -L %{_bindir}/sphinx-autogen ]] && rm -f %{_bindir}/sphinx-autogen
[[ ! -L %{_bindir}/sphinx-quickstart ]] && rm -f %{_bindir}/sphinx-quickstart
[[ ! -L %{_mandir}/man1/sphinx-all.1.gz ]] && rm -f %{_mandir}/man1/sphinx-all.1.gz
[[ ! -L %{_mandir}/man1/sphinx-apidoc.1.gz ]] && rm -f %{_mandir}/man1/sphinx-apidoc.1.gz
[[ ! -L %{_mandir}/man1/sphinx-build.1.gz ]] && rm -f %{_mandir}/man1/sphinx-build.1.gz
[[ ! -L %{_mandir}/man1/sphinx-quickstart.1.gz ]] && rm -f %{_mandir}/man1/sphinx-quickstart.1.gz
exit 0
%post
update-alternatives \
--install %{_bindir}/sphinx-apidoc sphinx-apidoc %{_bindir}/sphinx-apidoc-%{py_ver} 10 \
--install %{_bindir}/sphinx-apidoc sphinx-apidoc %{_bindir}/sphinx-apidoc-%{py_ver} 20 \
--slave %{_bindir}/sphinx-build sphinx-build %{_bindir}/sphinx-build-%{py_ver} \
--slave %{_bindir}/sphinx-autogen sphinx-autogen %{_bindir}/sphinx-autogen-%{py_ver} \
--slave %{_bindir}/sphinx-quickstart sphinx-quickstart %{_bindir}/sphinx-quickstart-%{py_ver} \
@ -113,9 +128,9 @@ update-alternatives \
--slave %{_mandir}/man1/sphinx-build.1.gz sphinx-build.1 %{_mandir}/sphinx-build-%{py_ver}.1.gz \
--slave %{_mandir}/man1/sphinx-quickstart.1.gz sphinx-quickstart.1 %{_mandir}/sphinx-quickstart-%{py_ver}.1.gz \
%postun
%preun
if [ $1 -eq 0 ] ; then
update-alternatives --remove sphinx-build %{_bindir}/sphinx-apidoc-%{py_ver}
update-alternatives --remove sphinx-build %{_bindir}/sphinx-apidoc-%{py_ver}
fi
%files -f sphinx.lang

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Thu May 16 10:33:34 UTC 2013 - speilicke@suse.com
- Fix update-alternatives and support upgrade from previous versions
-------------------------------------------------------------------
Tue May 7 08:16:04 UTC 2013 - highwaystar.ru@gmail.com

View File

@ -77,6 +77,8 @@ and translating suite, the Docutils.
%setup -q -n Sphinx-%{version}
%patch0
sed -i '/#\!/d' sphinx/pycode/pgen2/token.py # Fix non-excutable-script warning
# Add Interpreter version suffix to entrypoints (and thus /usr/bin binaries) to
# allow for update-alternatives later on:
sed -i "s|\(sphinx-.*\) =|\1-%{py3_ver} =|" setup.py # Add Python version suffix to binaries
sed -i "s|'\(sphinx-[a-z]*\)'|'\1-%{py3_ver}'|" doc/conf.py # Do the same for man-pages
@ -89,22 +91,35 @@ python3 setup.py build_sphinx -b man # Build man-pages
%install
python3 setup.py install --prefix=%{_prefix} --root=%{buildroot}
for B in apidoc autogen build quickstart ; do
touch %{buildroot}%{_bindir}/sphinx-$B
ln -s %{_bindir}/sphinx-$B-%{py3_ver} %{buildroot}%{_bindir}/sphinx-$B
done
install -d %{buildroot}%{_mandir}/man1/
for M in all apidoc build quickstart ; do
install -m 644 build/sphinx/man/sphinx-$M-%{py3_ver}.1 %{buildroot}%{_mandir}/man1/sphinx-$M-%{py3_ver}.1
touch %{buildroot}%{_mandir}/man1/sphinx-$M.1
ln -s %{_mandir}/man1/sphinx-$M-%{py3_ver}.1 %{buildroot}%{_mandir}/man1/sphinx-$M.1
done
%find_lang sphinx
#TODO: Fix
#%%check
#nosetests-%{py3_ver}
#nosetests-%%{py3_ver}
%pre
# Since /usr/bin/sphinx-* became ghosted to be used with update-alternatives, we have
# to get rid of the old binary resulting from the non-update-alternativies-ified package:
[[ ! -L %{_bindir}/sphinx-apidoc ]] && rm -f %{_bindir}/sphinx-apidoc
[[ ! -L %{_bindir}/sphinx-build ]] && rm -f %{_bindir}/sphinx-build
[[ ! -L %{_bindir}/sphinx-autogen ]] && rm -f %{_bindir}/sphinx-autogen
[[ ! -L %{_bindir}/sphinx-quickstart ]] && rm -f %{_bindir}/sphinx-quickstart
[[ ! -L %{_mandir}/man1/sphinx-all.1.gz ]] && rm -f %{_mandir}/man1/sphinx-all.1.gz
[[ ! -L %{_mandir}/man1/sphinx-apidoc.1.gz ]] && rm -f %{_mandir}/man1/sphinx-apidoc.1.gz
[[ ! -L %{_mandir}/man1/sphinx-build.1.gz ]] && rm -f %{_mandir}/man1/sphinx-build.1.gz
[[ ! -L %{_mandir}/man1/sphinx-quickstart.1.gz ]] && rm -f %{_mandir}/man1/sphinx-quickstart.1.gz
exit 0
%post
update-alternatives \
--install %{_bindir}/sphinx-apidoc sphinx-apidoc %{_bindir}/sphinx-apidoc-%{py3_ver} 10 \
--install %{_bindir}/sphinx-apidoc sphinx-apidoc %{_bindir}/sphinx-apidoc-%{py3_ver} 30 \
--slave %{_bindir}/sphinx-build sphinx-build %{_bindir}/sphinx-build-%{py3_ver} \
--slave %{_bindir}/sphinx-autogen sphinx-autogen %{_bindir}/sphinx-autogen-%{py3_ver} \
--slave %{_bindir}/sphinx-quickstart sphinx-quickstart %{_bindir}/sphinx-quickstart-%{py3_ver} \
@ -113,7 +128,7 @@ update-alternatives \
--slave %{_mandir}/man1/sphinx-build.1.gz sphinx-build.1 %{_mandir}/sphinx-build-%{py3_ver}.1.gz \
--slave %{_mandir}/man1/sphinx-quickstart.1.gz sphinx-quickstart.1 %{_mandir}/sphinx-quickstart-%{py3_ver}.1.gz \
%postun
%preun
if [ $1 -eq 0 ] ; then
update-alternatives --remove sphinx-build %{_bindir}/sphinx-apidoc-%{py3_ver}
fi