Modernize spec
This commit is contained in:
parent
4adf7b746c
commit
a3401df083
@ -1,7 +1,3 @@
|
||||
%if 0%{?fedora} || 0%{?rhel} > 7
|
||||
%global with_python3 0%{!?_without_python3:1}
|
||||
%endif
|
||||
|
||||
%global srcname docutils
|
||||
|
||||
Name: python-%{srcname}
|
||||
@ -9,7 +5,6 @@ Version: 0.14
|
||||
Release: 5%{?dist}
|
||||
Summary: System for processing plaintext documentation
|
||||
|
||||
Group: Development/Languages
|
||||
# See COPYING.txt for information
|
||||
License: Public Domain and BSD and Python and GPLv3+
|
||||
URL: http://docutils.sourceforge.net
|
||||
@ -25,10 +20,8 @@ BuildArch: noarch
|
||||
|
||||
BuildRequires: python2-devel
|
||||
BuildRequires: python2-setuptools
|
||||
%if 0%{?with_python3}
|
||||
BuildRequires: python3-devel
|
||||
BuildRequires: python2-tools
|
||||
%endif
|
||||
BuildRequires: python3-setuptools
|
||||
|
||||
%description
|
||||
The Docutils project specifies a plaintext markup language, reStructuredText,
|
||||
@ -44,8 +37,6 @@ Python inline documentation modules and packages.
|
||||
%package -n python2-%{srcname}
|
||||
Summary: System for processing plaintext documentation for python2
|
||||
%{?python_provide:%python_provide python2-%{srcname}}
|
||||
Provides: docutils = %{version}-%{release}
|
||||
Obsoletes: docutils < %{version}-%{release}
|
||||
|
||||
%description -n python2-%{srcname}
|
||||
The Docutils project specifies a plaintext markup language, reStructuredText,
|
||||
@ -58,11 +49,9 @@ 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.
|
||||
|
||||
%if 0%{?with_python3}
|
||||
%package -n python3-%{srcname}
|
||||
Summary: System for processing plaintext documentation for python3
|
||||
%{?python_provide:%python_provide python3-%{srcname}}
|
||||
Group: Development/Languages
|
||||
|
||||
%description -n python3-%{srcname}
|
||||
The Docutils project specifies a plaintext markup language, reStructuredText,
|
||||
@ -76,10 +65,14 @@ PEPs (Python Enhancement Proposals). Work is underway to parse rST from
|
||||
Python inline documentation modules and packages.
|
||||
|
||||
This package contains the module, ported to run under python3.
|
||||
%endif # with_python3
|
||||
|
||||
|
||||
%prep
|
||||
%setup -q -n %{srcname}-%{version}
|
||||
%autosetup -c -n %{srcname}-%{version}
|
||||
|
||||
# Upstream needs separate python2 and 3 folders as it utilizes 2to3 in
|
||||
# a custom hackish way
|
||||
pushd %{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
|
||||
@ -89,80 +82,81 @@ done
|
||||
iconv -f ISO88592 -t UTF8 tools/editors/emacs/IDEAS.rst > tmp
|
||||
mv tmp tools/editors/emacs/IDEAS.rst
|
||||
|
||||
%if 0%{?with_python3}
|
||||
rm -rf %{py3dir}
|
||||
cp -a . %{py3dir}
|
||||
%endif
|
||||
popd
|
||||
|
||||
# Create the two folders mentioned above
|
||||
mv %{srcname}-%{version} python3
|
||||
cp -rp python3 python2
|
||||
|
||||
# Get the doc and license files out
|
||||
pushd python3
|
||||
cp -rp COPYING.txt licenses BUGS.txt FAQ.txt HISTORY.txt README.txt RELEASE-NOTES.txt THANKS.txt tools/editors ..
|
||||
popd
|
||||
|
||||
# We want the licenses but don't need this build file
|
||||
rm -f licenses/docutils.conf
|
||||
|
||||
%build
|
||||
pushd python2
|
||||
%py2_build
|
||||
popd
|
||||
|
||||
%if 0%{?with_python3}
|
||||
pushd %{py3dir}
|
||||
pushd python3
|
||||
%py3_build
|
||||
popd
|
||||
%endif # with_python3
|
||||
|
||||
|
||||
%install
|
||||
pushd python2
|
||||
%py2_install
|
||||
|
||||
# Flash file is used for testing docutils but shouldn't be in the installed package.
|
||||
mv docs/user/rst/images/biohazard.swf ./biohazard.swf
|
||||
popd
|
||||
|
||||
rm -f %{buildroot}/%{_bindir}/*
|
||||
|
||||
pushd python3
|
||||
%py3_install
|
||||
mv docs/user/rst/images/biohazard.swf ./biohazard.swf
|
||||
popd
|
||||
|
||||
# docutils setup.py runs 2to3 on a copy of the tests and puts it in sitelib.
|
||||
rm -rf %{buildroot}%{python3_sitelib}/test
|
||||
|
||||
# Flash file is used for testing docutils but shouldn't be in the installed package.
|
||||
mv docs/user/rst/images/biohazard.swf ./biohazard.swf
|
||||
|
||||
%if 0%{?with_python3}
|
||||
rm -f %{buildroot}/%{_bindir}/*
|
||||
%endif # with_python3
|
||||
|
||||
%if 0%{?with_python3}
|
||||
pushd %{py3dir}
|
||||
%py3_install
|
||||
# We want the licenses but don't need this build file
|
||||
rm -f licenses/docutils.conf
|
||||
|
||||
# Flash file is used for testing docutils but shouldn't be in the installed package.
|
||||
mv docs/user/rst/images/biohazard.swf ./biohazard.swf
|
||||
popd
|
||||
%endif # with_python3
|
||||
|
||||
for file in %{buildroot}/%{_bindir}/*.py; do
|
||||
mv $file `dirname $file`/`basename $file .py`
|
||||
mv $file `dirname $file`/`basename $file .py`
|
||||
done
|
||||
|
||||
|
||||
%check
|
||||
mv biohazard.swf docs/user/rst/images/biohazard.swf
|
||||
python2 test/alltests.py
|
||||
rm docs/user/rst/images/biohazard.swf
|
||||
for PY in 2 3; do
|
||||
pushd python${PY}
|
||||
mv biohazard.swf docs/user/rst/images/biohazard.swf
|
||||
python${PY} test${PY/2/}/alltests.py
|
||||
rm docs/user/rst/images/biohazard.swf
|
||||
popd
|
||||
done
|
||||
|
||||
%if 0%{?with_python3}
|
||||
pushd %{py3dir}
|
||||
mv biohazard.swf docs/user/rst/images/biohazard.swf
|
||||
python3 test3/alltests.py
|
||||
rm docs/user/rst/images/biohazard.swf
|
||||
popd
|
||||
%endif
|
||||
|
||||
%files -n python2-%{srcname}
|
||||
%license COPYING.txt licenses/*
|
||||
%doc BUGS.txt COPYING.txt FAQ.txt HISTORY.txt README.txt RELEASE-NOTES.txt
|
||||
%doc THANKS.txt docs tools/editors
|
||||
%{python2_sitelib}/*
|
||||
%doc BUGS.txt FAQ.txt HISTORY.txt README.txt RELEASE-NOTES.txt
|
||||
%doc THANKS.txt python2/docs editors
|
||||
%{python2_sitelib}/%{srcname}/
|
||||
%{python2_sitelib}/%{srcname}-%{version}-py%{python2_version}.egg-info
|
||||
|
||||
|
||||
%if 0%{?with_python3}
|
||||
%files -n python3-%{srcname}
|
||||
%license COPYING.txt licenses/*
|
||||
%doc BUGS.txt FAQ.txt HISTORY.txt README.txt RELEASE-NOTES.txt
|
||||
%doc THANKS.txt docs tools/editors
|
||||
%{python3_sitelib}/*
|
||||
%endif
|
||||
|
||||
# Leave this at the end to end up in the proper one
|
||||
%doc THANKS.txt python3/docs editors
|
||||
%{python3_sitelib}/%{srcname}/
|
||||
%{python3_sitelib}/%{srcname}-%{version}-py%{python3_version}.egg-info
|
||||
%{_bindir}/*
|
||||
|
||||
|
||||
%changelog
|
||||
* Thu Jul 12 2018 Miro Hrončok <mhroncok@redhat.com> - 0.14-5
|
||||
- Only ship one version of the rst2* executables
|
||||
|
Loading…
Reference in New Issue
Block a user