This commit is contained in:
Terje Røsten 2018-02-07 18:51:46 +01:00
parent 6039a02027
commit 86151b0dd8

View File

@ -1,16 +1,11 @@
%if 0%{?fedora} || 0%{?rhel} > 7
%global with_python3 1
%endif
%global oname beautifulsoup4
Name: python-beautifulsoup4
Version: 4.6.0
Release: 5%{?dist}
Release: 6%{?dist}
Summary: HTML/XML parser for quick-turnaround applications like screen-scraping
Group: Development/Languages
License: MIT
URL: http://www.crummy.com/software/BeautifulSoup/
Source0: https://files.pythonhosted.org/packages/source/b/%{oname}/%{oname}-%{version}.tar.gz
Source0: https://files.pythonhosted.org/packages/source/b/beautifulsoup4/beautifulsoup4-%{version}.tar.gz
BuildArch: noarch
BuildRequires: python2-devel >= 2.7
# html5lib BR just for test coverage
@ -18,13 +13,19 @@ BuildRequires: python2-html5lib
BuildRequires: python2-setuptools
BuildRequires: python2-lxml
BuildRequires: /usr/bin/2to3
BuildRequires: python2-tools
# html5lib BR just for test coverage
BuildRequires: python3-html5lib
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-lxml
%global _description\
Beautiful Soup is a Python HTML/XML parser designed for quick\
turnaround projects like screen-scraping. Three features make it\
powerful:\
\
Beautiful Soup won't choke if you give it bad markup.\
Beautiful Soup wont choke if you give it bad markup.\
\
Beautiful Soup provides a few simple methods and Pythonic idioms for\
navigating, searching, and modifying a parse tree.\
@ -44,95 +45,53 @@ minutes with Beautiful Soup.
Summary: %summary
Requires: python2-lxml
%{?python_provide:%python_provide python2-beautifulsoup4}
%description -n python2-beautifulsoup4 %_description
%if 0%{?with_python3}
%package -n python3-beautifulsoup4
Summary: HTML/XML parser for quick-turnaround applications like screen-scraping
Group: Development/Languages
BuildRequires: python2-tools
# html5lib BR just for test coverage
BuildRequires: python3-html5lib
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-lxml
Summary: %summary
Requires: python3-lxml
Obsoletes: python3-BeautifulSoup < 1:3.2.1-2
%description -n python3-beautifulsoup4
Beautiful Soup is a Python HTML/XML parser designed for quick
turnaround projects like screen-scraping. Three features make it
powerful:
Beautiful Soup won't choke if you give it bad markup.
Beautiful Soup provides a few simple methods and Pythonic idioms for
navigating, searching, and modifying a parse tree.
Beautiful Soup automatically converts incoming documents to Unicode
and outgoing documents to UTF-8.
Beautiful Soup parses anything you give it.
Valuable data that was once locked up in poorly-designed websites is
now within your reach. Projects that would have taken hours take only
minutes with Beautiful Soup.
This is the Python 3 build of Beautiful Soup.
%endif # if with_python3
%description -n python3-beautifulsoup4 %_description
%prep
%setup -q -n %{oname}-%{version}
%setup -q -n beautifulsoup4-%{version}
mv AUTHORS.txt AUTHORS.txt.iso
iconv -f ISO-8859-1 -t UTF-8 -o AUTHORS.txt AUTHORS.txt.iso
touch -r AUTHORS.txt.iso AUTHORS.txt
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif
rm -rf %{py3dir} && cp -a . %{py3dir}
%build
%{__python} setup.py build
%if 0%{?with_python3}
%{py2_build}
pushd %{py3dir}
2to3 --write --nobackups .
%{__python3} setup.py build
%endif
%{py3_build}
%install
%{__python} setup.py install -O1 --skip-build --root %{buildroot}
%if 0%{?with_python3}
%{py2_install}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
%endif
%{py3_install}
%check
%{__python} -m unittest discover -s bs4
%if 0%{?with_python3}
%{__python2} -m unittest discover -s bs4
pushd %{py3dir}
%{__python3} -m unittest discover -s bs4
%endif
%files -n python2-beautifulsoup4
%license COPYING.txt
%doc AUTHORS.txt NEWS.txt README.txt TODO.txt
%{python_sitelib}/beautifulsoup4-%{version}*.egg-info
%{python_sitelib}/bs4
%{python2_sitelib}/beautifulsoup4-%{version}*.egg-info
%{python2_sitelib}/bs4
%if 0%{?with_python3}
%files -n python3-beautifulsoup4
%license COPYING.txt
%doc AUTHORS.txt NEWS.txt README.txt TODO.txt
%{python3_sitelib}/beautifulsoup4-%{version}*.egg-info
%{python3_sitelib}/bs4
%endif
%changelog
* Wed Feb 07 2018 Terje Rosten <terje.rosten@ntnu.no> - 4.6.0-6
- Clean up
* Wed Feb 07 2018 Iryna Shcherbina <ishcherb@redhat.com> - 4.6.0-5
- Update Python 2 dependency declarations to new packaging standards
(See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)