From a7beaf5a5cb36eb129f61c91f09b5436576fb01ef90b5d090c8b15f40833d6a1 Mon Sep 17 00:00:00 2001 From: Thomas Bechtold Date: Fri, 19 May 2017 14:14:31 +0000 Subject: [PATCH] Accepting request 495465 from home:benoit_monin:branches:devel:languages:python - convert the package to singlespec - call fdupes to fix duplicated files - fix encoding of the single file with CR/LF: avoid python-bytecode-inconsistent-mtime in every other files This time with %python_subpackages above %description. OBS-URL: https://build.opensuse.org/request/show/495465 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Markdown?expand=0&rev=37 --- python-Markdown.changes | 8 ++++++ python-Markdown.spec | 55 +++++++++++++++++++---------------------- 2 files changed, 33 insertions(+), 30 deletions(-) diff --git a/python-Markdown.changes b/python-Markdown.changes index ef9e7b1..e57b6f8 100644 --- a/python-Markdown.changes +++ b/python-Markdown.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Sun May 7 13:22:13 UTC 2017 - benoit.monin@gmx.fr + +- convert the package to singlespec +- call fdupes to fix duplicated files +- fix encoding of the single file with CR/LF: + avoid python-bytecode-inconsistent-mtime in every other files + ------------------------------------------------------------------- Thu Jan 26 20:11:27 UTC 2017 - benoit.monin@gmx.fr diff --git a/python-Markdown.spec b/python-Markdown.spec index 2e1958f..eb88785 100644 --- a/python-Markdown.spec +++ b/python-Markdown.spec @@ -16,6 +16,8 @@ # +%{?!python_module:%define python_module() python-%{**} python3-%{**}} +%define oldpython python Name: python-Markdown Version: 2.6.8 Release: 0 @@ -24,22 +26,25 @@ License: BSD-3-Clause Group: Development/Languages/Python Url: http://packages.python.org/Markdown/ Source: https://files.pythonhosted.org/packages/source/M/Markdown/Markdown-%{version}.tar.gz -BuildRequires: python-PyYAML -BuildRequires: python-devel -BuildRequires: python-nose -BuildRequires: python-xml +BuildRequires: %{python_module PyYAML} +BuildRequires: %{python_module devel} +BuildRequires: %{python_module nose} +BuildRequires: %{python_module xml} +BuildRequires: fdupes +BuildRequires: python-rpm-macros Requires: python-xml Requires(post): update-alternatives Requires(postun): update-alternatives BuildRoot: %{_tmppath}/%{name}-%{version}-build -Provides: python-markdown = %{version} -Obsoletes: python-markdown < %{version} -%if 0%{?suse_version} && 0%{?suse_version} <= 1110 -%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} -%else BuildArch: noarch +%ifpython2 +# older python2 version provided the package in lowercase +Provides: %{oldpython}-markdown = %{version} +Obsoletes: %{oldpython}-markdown < %{version} %endif +%python_subpackages + %description This is a Python implementation of John Gruber's [Markdown][]. It is almost completely compliant with the reference implementation, @@ -50,41 +55,31 @@ supported by the [Available Extensions][]. %prep %setup -q -n Markdown-%{version} # Fix encoding -find . -type f -not -name py.png -print0 | xargs -0 sed -i "s|\r$||" +sed -i "s|\r$||" docs/release-2.2.0.txt %build -python setup.py build +%python_build %install -python setup.py install --prefix=%{_prefix} --root=%{buildroot} +%python_install +%fdupes %{buildroot}%{_prefix} -# update-alternatives -mv %{buildroot}%{_bindir}/markdown_py %{buildroot}%{_bindir}/markdown_py-%{py_ver} -mkdir -p %{buildroot}%{_sysconfdir}/alternatives -touch %{buildroot}%{_sysconfdir}/alternatives/markdown_py -ln -sf %{_sysconfdir}/alternatives/markdown_py %{buildroot}%{_bindir}/markdown_py +%python_clone -a %{buildroot}%{_bindir}/markdown_py -%if 0%{?suse_version} && 0%{?suse_version} > 1110 %check -python run-tests.py -%endif +%python_exec run-tests.py %post -update-alternatives \ - --install %{_bindir}/markdown_py markdown_py %{_bindir}/markdown_py-%{py_ver} 20 +%python_install_alternative markdown_py %postun -if [ $1 -eq 0 ] ; then - update-alternatives --remove markdown_py %{_bindir}/markdown_py-%{py_ver} -fi +%python_uninstall_alternative markdown_py -%files +%files %{python_files} %defattr(-,root,root,-) %doc LICENSE.md README.md docs/* -%ghost %{_sysconfdir}/alternatives/markdown_py -%{_bindir}/markdown_py -%{_bindir}/markdown_py-%{py_ver} -%{python_sitelib}/Markdown-%{version}-py%{py_ver}.egg-info +%python_alternative %{_bindir}/markdown_py +%{python_sitelib}/Markdown-%{version}-py%{python_version}.egg-info %{python_sitelib}/markdown %changelog