diff --git a/.gitignore b/.gitignore index dafa321..4ae0d57 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -/*.tar.* +SOURCES/beautifulsoup4-4.12.3.tar.gz diff --git a/.python-beautifulsoup4.metadata b/.python-beautifulsoup4.metadata new file mode 100644 index 0000000..9127716 --- /dev/null +++ b/.python-beautifulsoup4.metadata @@ -0,0 +1 @@ +708ecef86a326d0f4e1de1467274da0d901d522a SOURCES/beautifulsoup4-4.12.3.tar.gz diff --git a/SOURCES/beautifulsoup4-4.12-disable-soupsieve.patch b/SOURCES/beautifulsoup4-4.12-disable-soupsieve.patch new file mode 100644 index 0000000..3a63430 --- /dev/null +++ b/SOURCES/beautifulsoup4-4.12-disable-soupsieve.patch @@ -0,0 +1,12 @@ +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -29,9 +29,6 @@ classifiers = [ + "Topic :: Text Processing :: Markup :: SGML", + "Topic :: Text Processing :: Markup :: XML", + ] +-dependencies = [ +- "soupsieve >1.2", +-] + + [project.optional-dependencies] + html5lib = [ diff --git a/SOURCES/soupsieve26.patch b/SOURCES/soupsieve26.patch new file mode 100644 index 0000000..96c8eb4 --- /dev/null +++ b/SOURCES/soupsieve26.patch @@ -0,0 +1,48 @@ +From 9786a62726de5a8caba10021c4d4a58c8a3e9e3f Mon Sep 17 00:00:00 2001 +From: Leonard Richardson +Date: Wed, 21 Aug 2024 20:18:33 -0400 +Subject: * Changes to make tests work whether tests are run under soupsieve + 2.6 or an earlier version. Based on a patch by Stefano Rivera. + +--- + bs4/tests/test_css.py | 13 +++++++++++-- + 1 files changed, 11 insertions(+), 2 deletions(-) + +diff --git a/bs4/tests/test_css.py b/bs4/tests/test_css.py +index 359dbcd..3c2318b 100644 +--- a/bs4/tests/test_css.py ++++ b/bs4/tests/test_css.py +@@ -8,14 +8,23 @@ from bs4 import ( + ResultSet, + ) + ++from packaging.version import Version ++ + from . import ( + SoupTest, + SOUP_SIEVE_PRESENT, + ) + + if SOUP_SIEVE_PRESENT: +- from soupsieve import SelectorSyntaxError ++ from soupsieve import __version__, SelectorSyntaxError + ++ # Some behavior changes in soupsieve 2.6 that affects one of our ++ # tests. For the test to run under all versions of Python ++ # supported by Beautiful Soup (which includes versions of Python ++ # not supported by soupsieve 2.6) we need to check both behaviors. ++ SOUPSIEVE_EXCEPTION_ON_UNSUPPORTED_PSEUDOCLASS = SelectorSyntaxError ++ if Version(__version__) < Version("2.6"): ++ SOUPSIEVE_EXCEPTION_ON_UNSUPPORTED_PSEUDOCLASS = NotImplementedError + + @pytest.mark.skipif(not SOUP_SIEVE_PRESENT, reason="Soup Sieve not installed") + class TestCSSSelectors(SoupTest): +@@ -332,7 +341,7 @@ class TestCSSSelectors(SoupTest): + assert "yes" == chosen.string + + def test_unsupported_pseudoclass(self): +- with pytest.raises(NotImplementedError): ++ with pytest.raises(SOUPSIEVE_EXCEPTION_ON_UNSUPPORTED_PSEUDOCLASS): + self.soup.select("a:no-such-pseudoclass") + + with pytest.raises(SelectorSyntaxError): diff --git a/python-beautifulsoup4.spec b/SPECS/python-beautifulsoup4.spec similarity index 73% rename from python-beautifulsoup4.spec rename to SPECS/python-beautifulsoup4.spec index cb8c42a..4b41edc 100644 --- a/python-beautifulsoup4.spec +++ b/SPECS/python-beautifulsoup4.spec @@ -1,44 +1,35 @@ # Ciruclar dependency with soupsieve which must be disabled at times -%bcond_without soupsieve -%bcond_with tests - -%if 0%{?fedora} < 32 && 0%{?rhel} < 8 -%global py2 1 +%if 0%{?rhel} > 9 +%bcond soupsieve 0 +%bcond tests 0 +%else +%bcond soupsieve 1 +%bcond tests 1 %endif Name: python-beautifulsoup4 -Version: 4.10.0 -Release: 6%{?dist} +Version: 4.12.3 +Release: 8%{?dist} Summary: HTML/XML parser for quick-turnaround applications like screen-scraping License: MIT URL: http://www.crummy.com/software/BeautifulSoup/ Source0: https://files.pythonhosted.org/packages/source/b/beautifulsoup4/beautifulsoup4-%{version}.tar.gz -Patch0: nosieve.patch +# https://git.launchpad.net/beautifulsoup/commit/?id=9786a62726de5a8caba10021c4d4a58c8a3e9e3f +Patch1: soupsieve26.patch +Patch11: beautifulsoup4-4.12-disable-soupsieve.patch + BuildArch: noarch -%if 0%{?py2} -BuildRequires: python2-devel >= 2.7 -# html5lib BR just for test coverage -%if %{with tests} -BuildRequires: python2-html5lib -%endif -BuildRequires: python2-setuptools -%if %{with soupsieve} -BuildRequires: python2-soupsieve -%endif -BuildRequires: python2-lxml -BuildRequires: /usr/bin/2to3 -BuildRequires: python2-tools -%endif # html5lib BR just for test coverage %if %{with tests} BuildRequires: python3-html5lib +BuildRequires: python3-lxml %endif BuildRequires: python3-devel BuildRequires: python3-setuptools %if %{with soupsieve} +BuildRequires: python3-packaging BuildRequires: python3-soupsieve %endif -BuildRequires: python3-lxml %global _description %{expand: Beautiful Soup is a Python HTML/XML parser designed for quick @@ -61,18 +52,6 @@ minutes with Beautiful Soup.} %description %_description -%if 0%{?py2} -%package -n python2-beautifulsoup4 -Summary: %summary -Requires: python2-lxml -%if %{with soupsieve} -Requires: python2-soupsieve -%endif -%{?python_provide:%python_provide python2-beautifulsoup4} - -%description -n python2-beautifulsoup4 %_description -%endif - %package -n python3-beautifulsoup4 Summary: %summary Requires: python3-lxml @@ -85,54 +64,99 @@ Obsoletes: python3-BeautifulSoup < 1:3.2.1-2 %description -n python3-beautifulsoup4 %_description %prep -%setup -q -n beautifulsoup4-%{version} +%autosetup -p1 -N -n beautifulsoup4-%{version} +%autopatch -p1 -M 10 %if %{without soupsieve} -%patch0 -p1 +%autopatch -p1 -m 10 %endif +# Fix compatibility with lxml 5.3.0 +# Reported upstream: https://bugs.launchpad.net/beautifulsoup/+bug/2076897 +sed -i "s/strip_cdata=False,//" bs4/builder/_lxml.py -rm -rf %{py3dir} && cp -a . %{py3dir} - +%generate_buildrequires +%pyproject_buildrequires %{?with_tests: -t} %build -%{?py2:%{py2_build}} -pushd %{py3dir} -2to3 --write --nobackups . -%{py3_build} +%pyproject_wheel %install -%{?py2:%{py2_install}} -pushd %{py3dir} -%{py3_install} - -%check -%py3_check_import bs4 +%pyproject_install +%pyproject_save_files bs4 %if %{with tests} -%{?py2:%{__python2} -m unittest discover -s bs4 || : } -pushd %{py3dir} -%{__python3} -m unittest discover -s bs4 || : -%endif - -%if 0%{?py2} -%files -n python2-beautifulsoup4 -%license COPYING.txt -%doc NEWS.txt TODO.txt -%{python2_sitelib}/beautifulsoup4-%{version}*.egg-info -%{python2_sitelib}/bs4 +%check +%tox %endif %files -n python3-beautifulsoup4 -%license COPYING.txt -%doc NEWS.txt TODO.txt -%{python3_sitelib}/beautifulsoup4-%{version}*.egg-info +%license LICENSE +%doc NEWS.txt CHANGELOG +%{python3_sitelib}/beautifulsoup4-%{version}.dist-info/ %{python3_sitelib}/bs4 %changelog -* Mon Feb 14 2022 Steve Traylen - 4.10.0-6 -- Build with soupsieve dependency to close circular dependency +* Wed Dec 25 2024 Arkady L. Shane - 4.12.3-8 +- Rebuilt for MSVSphere 10 + +* Tue Oct 29 2024 Terje Rosten - 4.12.3-8 +- Add soupsieve option + +* Tue Aug 13 2024 Lumír Balhar - 4.12.3-7 +- Fix compatibility with lxml 5.3.0 + +* Fri Jul 19 2024 Fedora Release Engineering - 4.12.3-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + +* Fri Jun 07 2024 Python Maint - 4.12.3-5 +- Rebuilt for Python 3.13 + +* Fri Jun 07 2024 Python Maint - 4.12.3-4 +- Bootstrap for Python 3.13 + +* Fri Jan 26 2024 Fedora Release Engineering - 4.12.3-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Sun Jan 21 2024 Fedora Release Engineering - 4.12.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Wed Jan 17 2024 Terje Rosten - 4.12.3-1 +- 4.12.3 + +* Sat Dec 16 2023 Terje Rosten - 4.12.2-5 +- Add patch from upstream to fix test issue with libxml2 2.12.1 (bz#2251911) + +* Fri Jul 21 2023 Fedora Release Engineering - 4.12.2-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Fri Jun 16 2023 Python Maint - 4.12.2-3 +- Rebuilt for Python 3.12 + +* Tue Jun 13 2023 Python Maint - 4.12.2-2 +- Bootstrap for Python 3.12 + +* Thu Apr 13 2023 Terje Rosten - 4.12.2-1 +- 4.12.2 + +* Mon Mar 20 2023 Terje Rosten - 4.12.0-1 +- 4.12.0 + +* Thu Feb 02 2023 Terje Rosten - 4.11.2-1 +- 4.11.2 + +* Fri Jan 20 2023 Fedora Release Engineering - 4.11.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Thu Jan 05 2023 Major Hayden - 4.11.1-1 +- Update to 4.11.1 + +* Fri Jul 22 2022 Fedora Release Engineering - 4.11.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Mon Jun 13 2022 Python Maint - 4.11.0-2 +- Rebuilt for Python 3.11 -* Mon Feb 14 2022 Steve Traylen - 4.10.0-5 -- Build without soupsieve dependency to break circular dependency +* Sat Apr 09 2022 Terje Rosten - 4.11.0-1 +- 4.11.0 * Sun Feb 13 2022 Terje Rosten - 4.10.0-4 - Rebuild to get fc36/rawhide split diff --git a/nosieve.patch b/nosieve.patch deleted file mode 100644 index ad2b8d2..0000000 --- a/nosieve.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -uNr beautifulsoup4-4.10.0.ORIG/setup.py beautifulsoup4-4.10.0/setup.py ---- beautifulsoup4-4.10.0.ORIG/setup.py 2022-02-14 15:37:56.703109224 +0000 -+++ beautifulsoup4-4.10.0/setup.py 2022-02-14 15:38:05.522210911 +0000 -@@ -19,7 +19,6 @@ - description="Screen-scraping library", - python_requires='>3.0.0', - install_requires=[ -- "soupsieve >1.2", - ], - long_description=long_description, - long_description_content_type="text/markdown", diff --git a/sources b/sources deleted file mode 100644 index 1809527..0000000 --- a/sources +++ /dev/null @@ -1 +0,0 @@ -SHA512 (beautifulsoup4-4.10.0.tar.gz) = 92be99ed0fd479b86519395143516e28f7b80f54a8251223d6e7b88dc98f8dfca9585079f5f1d89bfe68f577de3dff433711642486303203f46bc76754959a18