Spec cleanup

- only write the summary and description once
- remove explicit %python_provide, not needed on F33+
  (after the python2 removal, this cannot be pushed down to F32 etc. anyway)
- no need to create a separate subfolder for python3 without python2
- explicitly only include commands matching rst*, not * (for safety)
- ensure .egg-info is a directory
- call python3 via the %python3 macro
- select files to remove shebangs from with grep instead of an outdated list

(There are no user facing changes, except couple removed shebangs, no need to rebuild.)
This commit is contained in:
Miro Hrončok 2020-04-18 21:13:03 +02:00
parent 38fccdd360
commit dbc9e77521

View File

@ -15,7 +15,7 @@ BuildArch: noarch
BuildRequires: python3-devel BuildRequires: python3-devel
BuildRequires: python3-setuptools BuildRequires: python3-setuptools
%description %global _description %{expand:
The Docutils project specifies a plaintext markup language, reStructuredText, The Docutils project specifies a plaintext markup language, reStructuredText,
which is easy to read and quick to write. The project includes a python 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 library to parse rST files and transform them into other useful formats such
@ -24,93 +24,62 @@ access to this functionality.
Currently, the library supports parsing rST that is in standalone files and Currently, the library supports parsing rST that is in standalone files and
PEPs (Python Enhancement Proposals). Work is underway to parse rST from PEPs (Python Enhancement Proposals). Work is underway to parse rST from
Python inline documentation modules and packages. Python inline documentation modules and packages.}
%description %_description
%package -n python3-%{srcname} %package -n python3-%{srcname}
Summary: System for processing plaintext documentation for python3 Summary: %{summary}
%{?python_provide:%python_provide python3-%{srcname}}
%description -n python3-%{srcname} %description -n python3-%{srcname} %_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.
This package contains the module, ported to run under python3.
%prep %prep
%autosetup -c -n %{srcname}-%{version} %autosetup -n %{srcname}-%{version}
pushd %{srcname}-%{version}
# Remove shebang from library files # 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}' $(grep -Erl '^#!.+python' %{srcname})
sed -i -e '/#! *\/usr\/bin\/.*/{1D}' $file
done
iconv -f ISO88592 -t UTF8 tools/editors/emacs/IDEAS.rst > tmp iconv -f ISO88592 -t UTF8 tools/editors/emacs/IDEAS.rst > tmp
mv tmp tools/editors/emacs/IDEAS.rst mv tmp tools/editors/emacs/IDEAS.rst
popd
# Create the two folders mentioned above
mv %{srcname}-%{version} python3
# 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 # We want the licenses but don't need this build file
rm -f licenses/docutils.conf rm -f licenses/docutils.conf
%if 0%{?python3_version_nodots} >= 38
# https://bugzilla.redhat.com/show_bug.cgi?id=1687377 # https://bugzilla.redhat.com/show_bug.cgi?id=1687377
rm python3/test/test_writers/test_odt.py rm test/test_writers/test_odt.py
%endif
%build %build
pushd python3
%py3_build %py3_build
popd
%install %install
pushd python3
%py3_install %py3_install
mv docs/user/rst/images/biohazard.swf ./biohazard.swf 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. # docutils setup.py runs 2to3 on a copy of the tests and puts it in sitelib.
rm -rf %{buildroot}%{python3_sitelib}/test rm -rf %{buildroot}%{python3_sitelib}/test
for file in %{buildroot}/%{_bindir}/*.py; do for file in %{buildroot}/%{_bindir}/*.py; do
mv $file `dirname $file`/`basename $file .py` mv $file `dirname $file`/`basename $file .py`
done done
%check %check
pushd python3
mv biohazard.swf docs/user/rst/images/biohazard.swf mv biohazard.swf docs/user/rst/images/biohazard.swf
python3 test/alltests.py %{python3} test/alltests.py
rm docs/user/rst/images/biohazard.swf rm docs/user/rst/images/biohazard.swf
popd
%files -n python3-%{srcname} %files -n python3-%{srcname}
%license COPYING.txt licenses/* %license COPYING.txt licenses/*
%doc BUGS.txt FAQ.txt HISTORY.txt README.txt RELEASE-NOTES.txt %doc BUGS.txt FAQ.txt HISTORY.txt README.txt RELEASE-NOTES.txt
%doc THANKS.txt python3/docs editors %doc THANKS.txt docs tools/editors
%{python3_sitelib}/%{srcname}/ %{python3_sitelib}/%{srcname}/
%{python3_sitelib}/%{srcname}-%{version}-py%{python3_version}.egg-info %{python3_sitelib}/%{srcname}-%{version}-py%{python3_version}.egg-info/
%{_bindir}/* %{_bindir}/rst*
%changelog %changelog