%if 0%{?fedora} || 0%{?rhel} >= 7 %bcond_without python3 %else %bcond_with python3 %endif %if 0%{?rhel} > 7 # Disable python2 build by default %bcond_with python2 %else %bcond_without python2 %endif %global srcname Markdown %global pkgname markdown %global __python3 /usr/bin/python3.11 %global python3_pkgversion 3.11 Name: python-%{pkgname} Version: 2.6.11 Release: 2%{?dist} Summary: Markdown implementation in Python License: BSD URL: https://python-markdown.github.io/ Source0: https://files.pythonhosted.org/packages/source/M/%{srcname}/%{srcname}-%{version}.tar.gz BuildArch: noarch %description This is a Python implementation of John Gruber's Markdown. It is almost completely compliant with the reference implementation, though there are a few known issues. %if %{with python2} %package -n python2-%{pkgname} Summary: Markdown implementation in Python BuildRequires: python2-devel BuildRequires: python2-nose %if ! 0%{?rhel} BuildRequires: python2-yaml %else BuildRequires: python-yaml %endif %{?python_provide:%python_provide python2-%{pkgname}} %description -n python2-%{pkgname} This is a Python implementation of John Gruber's Markdown. It is almost completely compliant with the reference implementation, though there are a few known issues. %endif # with python2 %if %{with python3} %package -n python%{python3_pkgversion}-%{pkgname} Summary: Markdown implementation in Python BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python%{python3_pkgversion}-nose BuildRequires: python%{python3_pkgversion}-PyYAML %{?python_provide:%python_provide python%{python3_pkgversion}-%{pkgname}} %description -n python%{python3_pkgversion}-%{pkgname} This is a Python implementation of John Gruber's Markdown. It is almost completely compliant with the reference implementation, though there are a few known issues. %endif # with python3 %prep %setup -qc -n %{srcname}-%{version} %if %{with python2} cp -a %{srcname}-%{version} python2 %endif # with python2 %if %{with python3} cp -a %{srcname}-%{version} python3 %endif # with python3 %build %if %{with python2} pushd python2 %py2_build popd %endif # with python2 %if %{with python3} pushd python3 %py3_build popd %endif # with python3 %install %if %{with python2} pushd python2 %py2_install # rename binary mv %{buildroot}%{_bindir}/markdown_py{,-%{python2_version}} ln -s markdown_py-%{python2_version} %{buildroot}%{_bindir}/markdown_py-2 # process license file PYTHONPATH=%{buildroot}%{python2_sitelib} \ %{buildroot}%{_bindir}/markdown_py-%{python2_version} \ LICENSE.md > LICENSE.html popd %endif # with python2 %if %{with python3} pushd python3 %py3_install # rename binary mv %{buildroot}%{_bindir}/markdown_py{,-%{python3_version}} ln -s markdown_py-%{python3_version} %{buildroot}%{_bindir}/markdown_py-3 # process license file PYTHONPATH=%{buildroot}%{python3_sitelib} \ %{buildroot}%{_bindir}/markdown_py-%{python3_version} \ LICENSE.md > LICENSE.html popd %endif # with python3 %if %{without python3} ln -s markdown_py-%{python2_version} %{buildroot}%{_bindir}/markdown_py %else ln -s markdown_py-%{python3_version} %{buildroot}%{_bindir}/markdown_py %endif # without python3 # %%check # %%if %%{with python2} # pushd python2 # %%{__python2} run-tests.py # popd # %%endif # with python2 # # %%if %%{with python3} # pushd python3 # %%{__python3} run-tests.py # popd # %%endif # with python3 %if %{with python2} %files -n python2-%{pkgname} # temporarily skip packaging docs - see also # https://github.com/Python-Markdown/markdown/issues/621 #doc python2/build/docs/* %license python2/LICENSE.* %{python2_sitelib}/* %if %{without python3} %{_bindir}/markdown_py %endif # without python3 %{_bindir}/markdown_py-2 %{_bindir}/markdown_py-%{python2_version} %endif # with python2 %if %{with python3} %files -n python%{python3_pkgversion}-%{pkgname} # temporarily skip packaging docs - see also # https://github.com/Python-Markdown/markdown/issues/621 #doc python3/build/docs/* %license python3/LICENSE.* %{python3_sitelib}/* %{_bindir}/markdown_py %{_bindir}/markdown_py-3 %{_bindir}/markdown_py-%{python3_version} %endif # with python3 %changelog