]>
Commit | Line | Data |
---|---|---|
39babf68 JK |
1 | # |
2 | # Conditional build: | |
6edb640d JB |
3 | %bcond_without doc # Sphinx documentation |
4 | %bcond_without tests # unit tests | |
39babf68 JK |
5 | %bcond_without python2 # CPython 2.x module |
6 | %bcond_without python3 # CPython 3.x module | |
7 | ||
8 | %define module bs4 | |
9 | Summary: beautifulsoup4 - Screen-scraping library | |
6edb640d | 10 | Summary(pl.UTF-8): beautifulsoup4 - biblioteka przechwytująca wyjście |
39babf68 | 11 | Name: python-%{module} |
2a80d360 JB |
12 | # keep 4.9.x here for python2 support |
13 | Version: 4.9.3 | |
14 | Release: 1 | |
39babf68 JK |
15 | License: MIT |
16 | Group: Libraries/Python | |
6edb640d JB |
17 | #Source0Download: https://pypi.org/simple/beautifulsoup4/ |
18 | Source0: https://files.pythonhosted.org/packages/source/b/beautifulsoup4/beautifulsoup4-%{version}.tar.gz | |
2a80d360 | 19 | # Source0-md5: 57fd468ae3eb055f6871106e8f7813e2 |
f3d1c76a | 20 | Patch0: test_suite.patch |
a307bef6 | 21 | Patch2: %{name}-smart_quotes.patch |
6edb640d JB |
22 | URL: https://www.crummy.com/software/BeautifulSoup/ |
23 | BuildRequires: rpmbuild(macros) >= 1.714 | |
39babf68 JK |
24 | BuildRequires: rpm-pythonprov |
25 | %if %{with python2} | |
6edb640d | 26 | BuildRequires: python-modules >= 1:2.7 |
39babf68 | 27 | BuildRequires: python-setuptools |
2a80d360 | 28 | BuildRequires: python-soupsieve >= 1.2 |
39babf68 JK |
29 | %endif |
30 | %if %{with python3} | |
2a80d360 | 31 | BuildRequires: python3-2to3 >= 1:3.2 |
6edb640d | 32 | BuildRequires: python3-modules >= 1:3.2 |
39babf68 | 33 | BuildRequires: python3-setuptools |
2a80d360 | 34 | BuildRequires: python3-soupsieve >= 1.2 |
39babf68 | 35 | %endif |
6edb640d | 36 | %if %{with doc} |
2a80d360 | 37 | BuildRequires: sphinx-pdg-2 |
6edb640d JB |
38 | %endif |
39 | Requires: python-modules >= 1:2.7 | |
39babf68 JK |
40 | BuildArch: noarch |
41 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
42 | ||
43 | %description | |
44 | Beautiful Soup sits atop an HTML or XML parser, providing Pythonic | |
45 | idioms for iterating, searching, and modifying the parse tree. | |
46 | ||
6edb640d JB |
47 | %description -l pl.UTF-8 |
48 | Beautiful Soup rezyduje powyżej parsera HTML lub XML, zapewniając | |
49 | pythonowe idiomy do iterowania, wyszukiwania i modyfikowania drzewa | |
50 | analizy. | |
51 | ||
39babf68 JK |
52 | %package -n python3-%{module} |
53 | Summary: beautifulsoup4 - Screen-scraping library | |
6edb640d | 54 | Summary(pl.UTF-8): beautifulsoup4 - biblioteka przechwytująca wyjście |
39babf68 | 55 | Group: Libraries/Python |
6edb640d | 56 | Requires: python3-modules >= 1:3.2 |
39babf68 JK |
57 | |
58 | %description -n python3-%{module} | |
59 | Beautiful Soup sits atop an HTML or XML parser, providing Pythonic | |
60 | idioms for iterating, searching, and modifying the parse tree. | |
61 | ||
6edb640d JB |
62 | %description -n python3-%{module} -l pl.UTF-8 |
63 | Beautiful Soup rezyduje powyżej parsera HTML lub XML, zapewniając | |
64 | pythonowe idiomy do iterowania, wyszukiwania i modyfikowania drzewa | |
65 | analizy. | |
66 | ||
67 | %package apidocs | |
68 | Summary: API documentation for Python beautifulsoup4 module | |
69 | Summary(pl.UTF-8): Dokumentacja API modułu Pythona beautifulsoup4 | |
70 | Group: Documentation | |
71 | ||
72 | %description apidocs | |
73 | API documentation for Python beautifulsoup4 module. | |
74 | ||
75 | %description apidocs -l pl.UTF-8 | |
76 | Dokumentacja API modułu Pythona beautifulsoup4. | |
77 | ||
39babf68 JK |
78 | %prep |
79 | %setup -q -n beautifulsoup4-%{version} | |
f3d1c76a | 80 | %patch0 -p1 |
a307bef6 | 81 | %patch2 -p1 |
39babf68 | 82 | |
2a80d360 JB |
83 | # no longer supported by setuptools |
84 | %{__sed} -i -e '/use_2to3/d' setup.py | |
85 | ||
39babf68 JK |
86 | %build |
87 | %if %{with python2} | |
2a80d360 JB |
88 | %py_build |
89 | ||
90 | %if %{with tests} | |
91 | %{__python} -m unittest discover -s bs4 | |
92 | %endif | |
39babf68 JK |
93 | %endif |
94 | ||
95 | %if %{with python3} | |
2a80d360 JB |
96 | %py3_build |
97 | ||
98 | 2to3-%{py3_ver} --no-diffs -n -w build-3/lib | |
99 | ||
100 | %if %{with tests} | |
101 | cd build-3/lib | |
102 | %{__python3} -m unittest discover -s bs4 | |
103 | cd ../.. | |
104 | %endif | |
39babf68 JK |
105 | %endif |
106 | ||
107 | %if %{with doc} | |
2a80d360 JB |
108 | %{__make} -C doc html \ |
109 | SPHINXBUILD=sphinx-build-2 | |
39babf68 JK |
110 | %endif |
111 | ||
112 | %install | |
113 | rm -rf $RPM_BUILD_ROOT | |
114 | ||
115 | %if %{with python2} | |
f3d1c76a | 116 | %py_install |
2a80d360 JB |
117 | |
118 | %{__rm} -r $RPM_BUILD_ROOT%{py_sitescriptdir}/bs4/tests | |
119 | %py_postclean | |
39babf68 JK |
120 | %endif |
121 | ||
122 | %if %{with python3} | |
f3d1c76a | 123 | %py3_install |
2a80d360 JB |
124 | |
125 | %{__rm} -r $RPM_BUILD_ROOT%{py3_sitescriptdir}/bs4/tests | |
39babf68 JK |
126 | %endif |
127 | ||
128 | %clean | |
129 | rm -rf $RPM_BUILD_ROOT | |
130 | ||
131 | %if %{with python2} | |
132 | %files | |
133 | %defattr(644,root,root,755) | |
2a80d360 | 134 | %doc COPYING.txt NEWS.txt README.md TODO.txt |
39babf68 JK |
135 | %{py_sitescriptdir}/bs4 |
136 | %{py_sitescriptdir}/beautifulsoup4-%{version}-py*.egg-info | |
137 | %endif | |
138 | ||
139 | %if %{with python3} | |
140 | %files -n python3-%{module} | |
141 | %defattr(644,root,root,755) | |
2a80d360 | 142 | %doc COPYING.txt NEWS.txt README.md TODO.txt |
39babf68 JK |
143 | %{py3_sitescriptdir}/bs4 |
144 | %{py3_sitescriptdir}/beautifulsoup4-%{version}-py*.egg-info | |
145 | %endif | |
6edb640d JB |
146 | |
147 | %if %{with doc} | |
148 | %files apidocs | |
149 | %defattr(644,root,root,755) | |
150 | %doc doc/build/html/{_images,_static,*.html,*.js} | |
151 | %endif |