python-docutils/python3-docutils.spec

79 lines
3.5 KiB
RPMSpec

#
# spec file for package python3-docutils
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define modname docutils
Name: python3-%{modname}
Version: 0.9
Release: 0
Summary: Python Documentation Utilities
License: Python-2.0 and BSD-2-Clause and GPL-2.0+ and GPL-3.0+ and SUSE-Public-Domain
Group: Development/Languages/Python
Url: http://docutils.sourceforge.net/
Source: http://downloads.sourceforge.net/project/%{modname}/%{modname}/%{version}/%{modname}-%{version}.tar.gz
BuildRequires: python3
BuildRequires: python3-2to3
BuildRequires: python3-devel
BuildRequires: python3-xml
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Requires: python3-xml
%if 0%{?suse_version} <= 1140
%{!?python3_sitelib: %global python3_sitelib %(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?py3_ver: %global py3_ver %(python3 -c "import sys; version=str(sys.version_info[0]) + '.' + str(sys.version_info[1]); print(version)" 2>/dev/null || echo PYTHON-NOT-FOUND)}
%endif
BuildArch: noarch
Requires: python3 >= %{py3_ver}
%description
Docutils is a modular system for processing documentation into useful formats,
such as HTML, XML, and LaTeX. For input Docutils supports reStructuredText, an
easy-to-read, what-you-see-is-what-you-get plaintext markup syntax.
%prep
%setup -n %{modname}-%{version}
%build
python3 setup.py build
sed -i "s|#!\s*\/usr\/bin\/env python3||g" docutils/{math/math2html,_string_template_compat,error_reporting,writers/xetex/__init__,math/latex2mathml}.py # Fix non-executable scripts
%install
python3 setup.py install --prefix=%{_prefix} --root=%{buildroot}
for i in %{buildroot}%{_bindir}/rst*; do mv "$i" "${i/.py}-python%{py3_ver}"; done # Remove useless ".py" ending from executables and add -python3.x suffix
# fix for non-executable-script rpmlint warning
chmod +x %{buildroot}%{python3_sitelib}/%{modname}/_string_template_compat.py
chmod +x %{buildroot}%{python3_sitelib}/%{modname}/error_reporting.py
chmod +x %{buildroot}%{python3_sitelib}/%{modname}/math/latex2mathml.py
chmod +x %{buildroot}%{python3_sitelib}/%{modname}/math/math2html.py
chmod +x %{buildroot}%{python3_sitelib}/%{modname}/utils/code_analyzer.py
chmod +x %{buildroot}%{python3_sitelib}/%{modname}/utils/punctuation_chars.py
chmod +x %{buildroot}%{python3_sitelib}/%{modname}/writers/xetex/__init__.py
# remove unneeded directories
rm -r %{buildroot}%{python3_sitelib}/test/
rm -r %{buildroot}%{python3_sitelib}/tools/
%files
%defattr(-,root,root,-)
%doc COPYING.txt FAQ.txt HISTORY.txt README.txt THANKS.txt BUGS.txt docs/* licenses
%{_bindir}/rst*-python%{py3_ver}
%{python3_sitelib}/%{modname}/
%{python3_sitelib}/%{modname}-%{version}-py%{py3_ver}.egg-info
%if 0%{?suse_version} <= 1140
%dir %{_prefix}/lib/python%{py3_ver}
%dir %{python3_sitelib}
%endif
%changelog