File python-docutils.spec of Package python-docutils

#

%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}

%global srcname docutils
%define maketest 0

Name:           python-%{srcname}
Summary:        System for processing plaintext documentation
Version:        0.12
Release:        1

Group:          Development/Languages
License:        GPL-3.0-or-later
URL:            http://docutils.sourceforge.net
Source0:        http://downloads.sourceforge.net/docutils/%{srcname}-%{version}.tar.gz

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch:       noarch

#!BuildIgnore:  dba-openssl-098o dba-openssl-098r dba-openssl-098x dba-openssl-101c dba-openssl-101e
%if 0%{?centos_version} >= 800 || 0%{?rhel_version} >= 800
BuildRequires: dba-python-391
%define pythdir /DBA/python/3.9.1
%global __python %{__python3}
%else
BuildRequires: python-devel
%endif

%if 0%{?suse_version} >= 1100
BuildRequires:          -post-build-checks
%endif


%description
The Docutils project specifies a plaintext markup language, reStructuredText,
which is easy to read and quick to write.  The project includes a python
library to parse rST files and transform them into other useful formats such
as HTML, XML, and TeX as well as commandline tools that give the enduser
access to this functionality.

Currently, the library supports parsing rST that is in standalone files and
PEPs (Python Enhancement Proposals).  Work is underway to parse rST from
Python inline documentation modules and packages.


%prep
%setup -q -n %{srcname}-%{version}

# Remove shebang from library files
for file in docutils/utils/{code_analyzer.py,punctuation_chars.py,error_reporting.py,smartquotes.py} docutils/utils/math/{latex2mathml.py,math2html.py} docutils/writers/xetex/__init__.py; do
sed -i -e '/#! *\/usr\/bin\/.*/{1D}' $file
done

iconv -f ISO88592 -t UTF8 tools/editors/emacs/IDEAS.rst > tmp
mv tmp tools/editors/emacs/IDEAS.rst


%build
%if 0%{?centos_version} >= 800 || 0%{?rhel_version} >= 800
export PATH="%{pythdir}/bin:$PATH"
export LD_LIBRARY_PATH="%{pythdir}/lib:$LD_LIBRARY_PATH"
export PYTHON="%{pythdir}/bin/python3"
%endif
CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build


%install
rm -rf %{buildroot}

%{__python} setup.py install --skip-build --root %{buildroot}

%if 0%{?sles_version} == 11
mkdir -p %{buildroot}/%{_bindir}/
mkdir -p %{buildroot}/%{_libdir}/
mv %{buildroot}/usr/local/bin/* %{buildroot}/usr/bin/
mv %{buildroot}/usr/local/lib*/* %{buildroot}%{_libdir}/
%endif

for file in %{buildroot}/%{_bindir}/*.py; do
    mv $file `dirname $file`/`basename $file .py`
done

# We want the licenses but don't need this build file
rm -f licenses/docutils.conf

%check
%if %maketest
python test/alltests.py
%endif


%clean
rm -rf %{buildroot}


%files
%defattr(-,root,root,-)
%doc BUGS.txt COPYING.txt FAQ.txt HISTORY.txt README.txt RELEASE-NOTES.txt 
%doc THANKS.txt licenses docs tools/editors
%{_bindir}/*
%{python_sitelib}/*


%changelog
* Fri Aug  5 2016 Holger Manthey <holger.manthey@bertelsmann.de>
- inital package
openSUSE Build Service is sponsored by