[packages/python-chardet] - added Sphinx documentation and unit tests

qboosh qboosh at pld-linux.org
Thu Jul 19 16:04:45 CEST 2018


commit 6dd1601cb889ee6a79c27f863072196f0ab0c5ce
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Thu Jul 19 16:06:38 2018 +0200

    - added Sphinx documentation and unit tests

 python-chardet.spec | 50 +++++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 43 insertions(+), 7 deletions(-)
---
diff --git a/python-chardet.spec b/python-chardet.spec
index a1a63a9..eb014c0 100644
--- a/python-chardet.spec
+++ b/python-chardet.spec
@@ -2,6 +2,8 @@
 # Conditional build:
 %bcond_without	python2	# CPython 2.x module
 %bcond_without	python3	# CPython 3.x module
+%bcond_without	doc	# Sphinx documentation
+%bcond_without	tests	# unit tets
 
 %define		module	chardet
 Summary:	Character encoding auto-detection in Python 2
@@ -11,18 +13,30 @@ Version:	3.0.4
 Release:	2
 License:	LGPL v2.1+
 Group:		Libraries/Python
-Source0:	https://pypi.python.org/packages/fc/bb/a5768c230f9ddb03acc9ef3f0d4a3cf93462473795d18e9535498c8f929d/chardet-3.0.4.tar.gz
+#Source0Download: https://pypi.org/simple/chardet/
+Source0:	https://files.pythonhosted.org/packages/source/c/chardet/%{module}-%{version}.tar.gz
 # Source0-md5:	7dd1ba7f9c77e32351b0a0cfacf4055c
-URL:		https://pypi.python.org/pypi/chardet
+URL:		https://pypi.org/project/chardet/
 %if %{with python2}
 BuildRequires:	python >= 1:2.6
 BuildRequires:	python-devel >= 1:2.6
 BuildRequires:	python-setuptools
+%if %{with tests}
+BuildRequires:	python-hypothesis
+BuildRequires:	python-pytest
+%endif
 %endif
 %if %{with python3}
-BuildRequires:	python3 >= 1:3.2
-BuildRequires:	python3-devel >= 1:3.2
+BuildRequires:	python3 >= 1:3.3
+BuildRequires:	python3-devel >= 1:3.3
 BuildRequires:	python3-setuptools
+%if %{with tests}
+BuildRequires:	python3-hypothesis
+BuildRequires:	python3-pytest
+%endif
+%endif
+%if %{with doc}
+BuildRequires:	sphinx-pdg
 %endif
 BuildRequires:	rpm-pythonprov
 BuildRequires:	rpmbuild(macros) >= 1.714
@@ -41,7 +55,7 @@ przeglądarce.
 Summary:	Character encoding auto-detection in Python 3
 Summary(pl.UTF-8):	Automatyczne wykrywanie kodowania znaków w Pythonie 3
 Group:		Libraries/Python
-Requires:	python3-modules >= 1:3.2
+Requires:	python3-modules >= 1:3.3
 
 %description -n python3-chardet
 Character encoding auto-detection in Python. As smart as your browser.
@@ -50,16 +64,32 @@ Character encoding auto-detection in Python. As smart as your browser.
 Automatyczne wykrywanie kodowania znaków w Pythonie. Tak zmyślne jak w
 przeglądarce.
 
+%package apidocs
+Summary:	API documentation for Python chardet module
+Summary(pl.UTF-8):	Dokumentacja API modułu Pythona chardet
+Group:		Documentation
+
+%description apidocs
+API documentation for Python chardet module.
+
+%description apidocs -l pl.UTF-8
+Dokumentacja API modułu Pythona chardet.
+
 %prep
 %setup -q -n %{module}-%{version}
 
 %build
 %if %{with python2}
-%py_build
+%py_build %{?with_tests:test}
 %endif
 
 %if %{with python3}
-%py3_build
+%py3_build %{?with_tests:test}
+%endif
+
+%if %{with doc}
+PYTHONPATH=$(pwd) \
+%{__make} -C docs html
 %endif
 
 %install
@@ -94,3 +124,9 @@ rm -rf $RPM_BUILD_ROOT
 %{py3_sitescriptdir}/chardet
 %{py3_sitescriptdir}/chardet-%{version}-py*.egg-info
 %endif
+
+%if %{with doc}
+%files apidocs
+%defattr(644,root,root,755)
+%doc docs/_build/html/{_modules,_static,api,*.html,*.js}
+%endif
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python-chardet.git/commitdiff/6dd1601cb889ee6a79c27f863072196f0ab0c5ce



More information about the pld-cvs-commit mailing list