]> git.pld-linux.org Git - packages/python-html5-parser.git/blob - python-html5-parser.spec
e770b662b206c0e72cb9160a0a347ab940cf48bd
[packages/python-html5-parser.git] / python-html5-parser.spec
1 #
2 # Conditional build:
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
6
7 %define         module html5-parser
8 Summary:        A fast, standards compliant, C based, HTML 5 parser for python
9 Name:           python-%{module}
10 Version:        0.4.5
11 Release:        6
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
20 %if %{with python2}
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
27 %endif
28 %if %{with python3}
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
35 %endif
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)
40
41 %description
42 A fast, standards compliant, C based, HTML 5 parser for python
43
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
48
49 %description -n python3-%{module}
50 A fast, standards compliant, C based, HTML 5 parser for python
51
52 %prep
53 %setup -q -n %{module}-%{version}
54
55 # remove shebangs from library files
56 %{__sed} -i -e '/^#!\//, 1d' src/html5_parser/*.py
57
58 %{__sed} -i -e '/extra_compile_args=cargs,/d' setup.py
59
60 %build
61 %if %{with python2}
62 %py_build %{?with_tests:test}
63 %endif
64
65 %if %{with python3}
66 %py3_build %{?with_tests:test}
67 %endif
68
69 %install
70 rm -rf $RPM_BUILD_ROOT
71
72 %if %{with python2}
73 %py_install
74
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}
80
81 %py_postclean
82 %endif
83
84 %if %{with python3}
85 %py3_install
86 %endif
87
88 %clean
89 rm -rf $RPM_BUILD_ROOT
90
91 %if %{with python2}
92 %files -n python-%{module}
93 %defattr(644,root,root,755)
94 %doc README.rst
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
99 %endif
100
101 %if %{with python3}
102 %files -n python3-%{module}
103 %defattr(644,root,root,755)
104 %doc README.rst
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
110 %endif
This page took 0.049374 seconds and 2 git commands to generate.