3 %bcond_with tests # do not perform "make test"
4 %bcond_without python2 # CPython 2.x module
5 %bcond_without python3 # CPython 3.x module
7 %define module html5-parser
8 Summary: A fast, standards compliant, C based, HTML 5 parser for python
12 # html5-parser-0.4.4/gumbo/utf8.c is MIT
13 License: ASL 2.0 and MIT
14 Group: Libraries/Python
15 Source0: https://files.pythonhosted.org/packages/source/h/%{module}/%{module}-%{version}.tar.gz
16 # Source0-md5: 0d133a1f6d8251f5a786df5074423e29
17 URL: https://pypi.python.org/pypi/%{module}
18 BuildRequires: rpm-pythonprov
19 BuildRequires: rpmbuild(macros) >= 1.714
21 BuildRequires: python-modules
22 BuildRequires: python-devel
23 BuildRequires: python-setuptools
24 BuildRequires: python-chardet
25 BuildRequires: python-bs4
26 BuildRequires: python-lxml >= 3.8.0
29 BuildRequires: python3-modules
30 BuildRequires: python3-devel
31 BuildRequires: python3-bs4
32 BuildRequires: python3-setuptools
33 BuildRequires: python3-chardet
34 BuildRequires: python3-lxml >= 3.8.0
36 BuildRequires: sed >= 4.0
37 # replace with other requires if defined in setup.py
38 Requires: python-modules
39 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
42 A fast, standards compliant, C based, HTML 5 parser for python
44 %package -n python3-%{module}
45 Summary: A fast, standards compliant, C based, HTML 5 parser for python
46 Group: Libraries/Python
47 Requires: python3-modules
49 %description -n python3-%{module}
50 A fast, standards compliant, C based, HTML 5 parser for python
53 %setup -q -n %{module}-%{version}
55 # remove shebangs from library files
56 %{__sed} -i -e '/^#!\//, 1d' src/html5_parser/*.py
58 %{__sed} -i -e '/extra_compile_args=cargs,/d' setup.py
62 %py_build %{?with_tests:test}
66 %py3_build %{?with_tests:test}
70 rm -rf $RPM_BUILD_ROOT
75 # when files are installed in other way that standard 'setup.py
76 # they need to be (re-)compiled
77 # change %{py_sitedir} to %{py_sitescriptdir} for 'noarch' packages!
78 %py_ocomp $RPM_BUILD_ROOT%{py_sitedir}
79 %py_comp $RPM_BUILD_ROOT%{py_sitedir}
89 rm -rf $RPM_BUILD_ROOT
92 %files -n python-%{module}
93 %defattr(644,root,root,755)
95 %dir %{py_sitedir}/html5_parser
96 %{py_sitedir}/html5_parser/*.py[co]
97 %attr(755,root,root) %{py_sitedir}/html5_parser/*.so
98 %{py_sitedir}/html5_parser-%{version}-py*.egg-info
102 %files -n python3-%{module}
103 %defattr(644,root,root,755)
105 %dir %{py3_sitedir}/html5_parser
106 %{py3_sitedir}/html5_parser/*.py
107 %attr(755,root,root) %{py3_sitedir}/html5_parser/*.so
108 %{py3_sitedir}/html5_parser/__pycache__
109 %{py3_sitedir}/html5_parser-%{version}-py*.egg-info