Accepting request 522042 from devel:languages:python

- common -doc subpackage
- improve packaging of docs (forwarded request 522041 from matejcik)

OBS-URL: https://build.opensuse.org/request/show/522042
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-FormEncode?expand=0&rev=11
This commit is contained in:
Dominique Leuenberger 2017-10-11 20:56:24 +00:00 committed by Git OBS Bridge
commit 8e403f76ed
2 changed files with 37 additions and 32 deletions

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Aug 24 13:38:57 UTC 2017 - jmatejek@suse.com
- singlespec auto-conversion
- common -doc subpackage
- improve packaging of docs
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Mar 9 10:07:35 UTC 2016 - bwiedemann@suse.com Wed Mar 9 10:07:35 UTC 2016 - bwiedemann@suse.com
@ -254,3 +261,4 @@ Thu Oct 13 00:00:00 CET 2005 - jfunk@funktronics.ca
- Initial release - Initial release

View File

@ -1,7 +1,7 @@
# #
# spec file for package python-FormEncode # spec file for package python-FormEncode
# #
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. # Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -16,42 +16,43 @@
# #
%define oldpython python
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-FormEncode Name: python-FormEncode
Version: 1.3.0 Version: 1.3.0
Release: 0 Release: 0
Url: http://formencode.org
Summary: HTML form validation, generation, and conversion package Summary: HTML form validation, generation, and conversion package
License: Python-2.0 License: Python-2.0
Group: Development/Languages/Python Group: Development/Languages/Python
Source: http://pypi.python.org/packages/source/F/FormEncode/FormEncode-%{version}.zip Url: http://formencode.org
Source: https://files.pythonhosted.org/packages/source/F/FormEncode/FormEncode-%{version}.zip
Source1: FormEncode-doc-infrastructure.tar.gz Source1: FormEncode-doc-infrastructure.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: fdupes
BuildRequires: python-devel
BuildRequires: python-setuptools
BuildRequires: unzip
Provides: python-formencode = %{version}
Obsoletes: python-formencode < %{version}
# Documentation requirements: # Documentation requirements:
BuildRequires: python-Sphinx BuildRequires: %{python_module devel}
BuildRequires: %{python_module setuptools}
%if 0%{?suse_version} && 0%{?suse_version} <= 1110 BuildRequires: fdupes
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} BuildRequires: python-rpm-macros
%else BuildRequires: python3-Sphinx
BuildRequires: unzip
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch BuildArch: noarch
%ifpython2
Provides: %{oldpython}-formencode = %{version}
Obsoletes: %{oldpython}-formencode < %{version}
%endif %endif
%python_subpackages
%description %description
FormEncode validates and converts nested structures. It allows for FormEncode validates and converts nested structures. It allows for
a declarative form of defining the validation, and decoupled processes a declarative form of defining the validation, and decoupled processes
for filling and generating forms. for filling and generating forms.
%package doc %package -n %{name}-doc
Summary: HTML form validation, generation, and conversion package Summary: HTML form validation, generation, and conversion package
Group: Development/Libraries/Python Group: Development/Libraries/Python
Requires: %{name} = %{version} Provides: %{python_module FormEncode-doc = %{version}}
%description doc %description -n %{name}-doc
This package contains documentation files for %{name}. This package contains documentation files for %{name}.
%prep %prep
@ -61,29 +62,25 @@ sed -i 's/\r$//g' PKG-INFO README.rst
sed -i '/^:date:/d' docs/*.txt # fix build-compare sed -i '/^:date:/d' docs/*.txt # fix build-compare
%build %build
python setup.py build %python_build
python setup.py build_sphinx && rm build/sphinx/html/.buildinfo %{_python_use_flavor python3}
python3 setup.py build_sphinx && rm build/sphinx/html/.buildinfo && mv build/sphinx/html html
%install %install
python setup.py install --prefix=%{_prefix} --root=%{buildroot} %python_install
# install documentation # install documentation
rm -r %{buildroot}/%{python_sitelib}/docs # remove misplaced documentation rm -r %{buildroot}%{python_sitelib}/docs # remove misplaced documentation
mkdir -p %{buildroot}%{_docdir}/%{name}
cp -r README.rst build/sphinx/html %{buildroot}%{_docdir}/%{name}/
%fdupes %{buildroot}/%{_prefix} %fdupes %{buildroot}%{_prefix}
%files %files %{python_files}
%defattr(-,root,root,-) %defattr(-,root,root,-)
%exclude %{_docdir}/%{name}/html %doc README.rst
%doc %dir %{_docdir}/%{name}/
%doc %{_docdir}/%{name}/README.rst
%{python_sitelib}/* %{python_sitelib}/*
%files doc %files -n %{name}-doc
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc %dir %{_docdir}/%{name}/html %doc html
%doc %{_docdir}/%{name}/html/*
%changelog %changelog