From d10e51faa3a9decf4eb647bf9eea1f8ba34b6ab3f4cd1b00257fa7410025cdc5 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Sat, 20 Jul 2024 16:18:51 +0000 Subject: [PATCH] - Update to 3.3.0 * Django versions 3-5 are supported, running on Python 3.8-3.12. * Releases are now created in GitHub Actions and published directly to PyPI, improving visibility into the build process. - Drop upstreamed patches: * gh-pr-1935_importlib.patch * unittest312.patch OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:django/python-django-haystack?expand=0&rev=20 --- .gitattributes | 23 ++++++++ .gitignore | 1 + django-haystack-3.2.1.tar.gz | 3 ++ django_haystack-3.3.0.tar.gz | 3 ++ gh-pr-1935_importlib.patch | 68 ++++++++++++++++++++++++ python-django-haystack.changes | 96 ++++++++++++++++++++++++++++++++++ python-django-haystack.spec | 83 +++++++++++++++++++++++++++++ unittest312.patch | 82 +++++++++++++++++++++++++++++ 8 files changed, 359 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 django-haystack-3.2.1.tar.gz create mode 100644 django_haystack-3.3.0.tar.gz create mode 100644 gh-pr-1935_importlib.patch create mode 100644 python-django-haystack.changes create mode 100644 python-django-haystack.spec create mode 100644 unittest312.patch diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/django-haystack-3.2.1.tar.gz b/django-haystack-3.2.1.tar.gz new file mode 100644 index 0000000..1273675 --- /dev/null +++ b/django-haystack-3.2.1.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:97e3197aefc225fe405b6f17600a2534bf827cb4d6743130c20bc1a06f7293a4 +size 466580 diff --git a/django_haystack-3.3.0.tar.gz b/django_haystack-3.3.0.tar.gz new file mode 100644 index 0000000..f889589 --- /dev/null +++ b/django_haystack-3.3.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e3ceed6b8000625da14d409eb4dac69894905e2ac8ac18f9bfdb59323ca02eab +size 467287 diff --git a/gh-pr-1935_importlib.patch b/gh-pr-1935_importlib.patch new file mode 100644 index 0000000..9c8bcb0 --- /dev/null +++ b/gh-pr-1935_importlib.patch @@ -0,0 +1,68 @@ +From da4651508e5d79e889fa2a7db5c0e40418703498 Mon Sep 17 00:00:00 2001 +From: Georg Pfuetzenreuter +Date: Fri, 12 Jan 2024 23:12:29 +0100 +Subject: [PATCH] Migrate away from pkg_resources + +Using pkg_resources as an API is deprecated. +Migrate functionality to their importlib and packaging equivalents. + +Signed-off-by: Georg Pfuetzenreuter +--- + haystack/__init__.py | 13 +++++++------ + test_haystack/solr_tests/test_solr_backend.py | 4 ++-- + 2 files changed, 9 insertions(+), 8 deletions(-) + +diff --git a/haystack/__init__.py b/haystack/__init__.py +index 94b8f4674..25448de96 100644 +--- a/haystack/__init__.py ++++ b/haystack/__init__.py +@@ -1,7 +1,9 @@ ++from importlib.metadata import PackageNotFoundError, version ++ + import django + from django.conf import settings + from django.core.exceptions import ImproperlyConfigured +-from pkg_resources import DistributionNotFound, get_distribution, parse_version ++from packaging.version import Version + + from haystack.constants import DEFAULT_ALIAS + from haystack.utils import loading +@@ -9,12 +11,11 @@ + __author__ = "Daniel Lindsley" + + try: +- pkg_distribution = get_distribution("django-haystack") +- __version__ = pkg_distribution.version +- version_info = pkg_distribution.parsed_version +-except DistributionNotFound: ++ __version__ = version("django-haystack") ++ version_info = Version(__version__) ++except PackageNotFoundError: + __version__ = "0.0.dev0" +- version_info = parse_version(__version__) ++ version_info = Version(__version__) + + + if django.VERSION < (3, 2): +diff --git a/test_haystack/solr_tests/test_solr_backend.py b/test_haystack/solr_tests/test_solr_backend.py +index d20347e7e..d8c95d329 100644 +--- a/test_haystack/solr_tests/test_solr_backend.py ++++ b/test_haystack/solr_tests/test_solr_backend.py +@@ -10,7 +10,7 @@ + from django.conf import settings + from django.test import TestCase + from django.test.utils import override_settings +-from pkg_resources import parse_version ++from packaging.version import Version + + from haystack import connections, indexes, reset_search_queries + from haystack.exceptions import SkipDocument +@@ -1650,7 +1650,7 @@ def test_boost(self): + + + @unittest.skipIf( +- parse_version(pysolr.__version__) < parse_version("3.1.1"), ++ Version(pysolr.__version__) < Version("3.1.1"), + "content extraction requires pysolr > 3.1.1", + ) + class LiveSolrContentExtractionTestCase(TestCase): diff --git a/python-django-haystack.changes b/python-django-haystack.changes new file mode 100644 index 0000000..3b583d7 --- /dev/null +++ b/python-django-haystack.changes @@ -0,0 +1,96 @@ +------------------------------------------------------------------- +Fri Jul 19 13:00:55 UTC 2024 - Markéta Machová + +- Update to 3.3.0 + * Django versions 3-5 are supported, running on Python 3.8-3.12. + * Releases are now created in GitHub Actions and published directly + to PyPI, improving visibility into the build process. +- Drop upstreamed patches: + * gh-pr-1935_importlib.patch + * unittest312.patch + +------------------------------------------------------------------- +Thu Mar 28 05:51:20 UTC 2024 - Max Lin + +- Numbering patches for fix Leap15 build + +------------------------------------------------------------------- +Fri Feb 9 12:32:21 UTC 2024 - Markéta Machová + +- Add upstream patch unittest312.patch to fix unittest asserts + +------------------------------------------------------------------- +Fri Jan 12 22:25:30 UTC 2024 - Georg Pfuetzenreuter + +- Add gh-pr-1935_importlib.patch to repair DistributionNotFound + error caused by deprecated pkg_resources APIs + +------------------------------------------------------------------- +Sun Jun 25 08:05:46 UTC 2023 - Andreas Schneider + +- Use sle15_python_module_pythons + +------------------------------------------------------------------- +Sun Sep 18 02:31:29 UTC 2022 - John Vandenberg + +- Update to v3.2.1 + * Fix Django 4.0 compatibility + * No changelog maintained upstream + +------------------------------------------------------------------- +Fri Jan 7 03:47:57 UTC 2022 - John Vandenberg + +- Skip Tumbleweed Python 3.6 incompatible with Django 4 + +------------------------------------------------------------------- +Sun Dec 26 23:30:09 UTC 2021 - John Vandenberg + +- Use django-codemod to make Django 4 compatible +- Remove unnecessary build dependency coverage + +------------------------------------------------------------------- +Fri Dec 3 04:17:14 UTC 2021 - Steve Kowalik + +- Update to 3.1.1: + * Considerable code and CI/CD cleanup + * Per-field configuration of Whoosh + * Whoosh faceting and other improvements + * ElasticSearch 7 support + * ElasticSearch 5 .models() support + * Minutes granularity for update_index management command + * update_index fix +- Switch from using nose to pytest-django +- Drop {Build,}Requires on six + +------------------------------------------------------------------- +Mon Feb 22 03:32:42 UTC 2021 - John Vandenberg + +- Add Suggests for backends pysolr and elasticsearch +- Remove missing build dependency on python36-GDAL +- Remove merged django3-support.patch +- Update to v3.0 + * See https://github.com/django-haystack/django-haystack/blob/master/docs/changelog.rst + for partial changelog since v2.8.1 +- Fix 2.4.1->2.8.1 in old changelog entry + +------------------------------------------------------------------- +Wed May 13 08:59:56 UTC 2020 - Marketa Calabkova + +- add upstream patch django3-support.patch + * using six replace django-six + +------------------------------------------------------------------- +Mon Dec 2 10:47:10 UTC 2019 - pgajdos@suse.com + +- call spec-cleaner + +------------------------------------------------------------------- +Wed Nov 6 12:38:34 UTC 2019 - pgajdos@suse.com + +- do not use setup.py test + +------------------------------------------------------------------- +Tue Oct 1 12:01:53 UTC 2019 - pgajdos@suse.com + +- initial version 2.8.1, needed by python-HyperKitty [SLE-7686] + diff --git a/python-django-haystack.spec b/python-django-haystack.spec new file mode 100644 index 0000000..8f199bf --- /dev/null +++ b/python-django-haystack.spec @@ -0,0 +1,83 @@ +# +# spec file for package python-django-haystack +# +# Copyright (c) 2024 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%{?sle15_python_module_pythons} +Name: python-django-haystack +Version: 3.3.0 +Release: 0 +Summary: Pluggable search for Django +License: BSD-3-Clause +URL: https://github.com/django-haystack/django-haystack +Source: https://files.pythonhosted.org/packages/source/d/django-haystack/django_haystack-%{version}.tar.gz +BuildRequires: %{python_module pip} +BuildRequires: %{python_module setuptools_scm} +BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +Requires: python-Django >= 2.2 +Requires: python-packaging +Suggests: python-elasticsearch +Suggests: python-pysolr >= 3.7.0 +Suggests: python-Whoosh >= 2.5.4 +BuildArch: noarch +# SECTION test requirements +BuildRequires: %{python_module Django >= 2.2} +BuildRequires: %{python_module Whoosh >= 2.5.4} +BuildRequires: %{python_module elasticsearch} +BuildRequires: %{python_module geopy >= 2.0.0} +BuildRequires: %{python_module pysolr >= 3.7.0} +BuildRequires: %{python_module pytest-django} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module python-dateutil} +BuildRequires: %{python_module requests} +BuildRequires: python3-GDAL +# /SECTION +%python_subpackages + +%description +Pluggable search for Django. + +%prep +%autosetup -n django_haystack-%{version} -p1 + +# This causes errors with pytest +sed -i '/django.setup()/d' test_haystack/__init__.py +echo 'import django; django.setup()' > conftest.py + +%build +%pyproject_wheel + +%install +%pyproject_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +export DJANGO_SETTINGS_MODULE=test_haystack.settings +# elasticsearch and solr tests require running services +# test_ensure_wgs84 is broken with some GDAL issues +%{python_expand export PYTHONPATH=%{buildroot}%{$python_sitelib}:${PWD} +$python -m pytest -rs -k 'not (elasticsearch or solr or test_ensure_wgs84)' +} + +%files %{python_files} +%doc AUTHORS README.rst +%license LICENSE +%{python_sitelib}/*haystack*/ + +%changelog diff --git a/unittest312.patch b/unittest312.patch new file mode 100644 index 0000000..471df13 --- /dev/null +++ b/unittest312.patch @@ -0,0 +1,82 @@ +From 3a566a50e4963bed4fb8853eca60bc894b0b7fc5 Mon Sep 17 00:00:00 2001 +From: Christian Clauss +Date: Mon, 1 Jan 2024 19:53:28 +0100 +Subject: [PATCH] Fix unittest assert calls for Python 3.12 + +--- + test_haystack/test_managers.py | 4 ++-- + test_haystack/test_query.py | 20 ++++++++++---------- + 2 files changed, 12 insertions(+), 12 deletions(-) + +diff --git a/test_haystack/test_managers.py b/test_haystack/test_managers.py +index 3784217cd..cc600752e 100644 +--- a/test_haystack/test_managers.py ++++ b/test_haystack/test_managers.py +@@ -242,11 +242,11 @@ def spelling_suggestion(self): + + def test_values(self): + sqs = self.search_index.objects.auto_query("test").values("id") +- self.assert_(isinstance(sqs, ValuesSearchQuerySet)) ++ self.assertIsInstance(sqs, ValuesSearchQuerySet) + + def test_valueslist(self): + sqs = self.search_index.objects.auto_query("test").values_list("id") +- self.assert_(isinstance(sqs, ValuesListSearchQuerySet)) ++ self.assertIsInstance(sqs, ValuesListSearchQuerySet) + + + class CustomManagerTestCase(TestCase): +diff --git a/test_haystack/test_query.py b/test_haystack/test_query.py +index ffe35c19a..f7e9a1707 100644 +--- a/test_haystack/test_query.py ++++ b/test_haystack/test_query.py +@@ -442,7 +442,7 @@ def test_len(self): + def test_repr(self): + reset_search_queries() + self.assertEqual(len(connections["default"].queries), 0) +- self.assertRegexpMatches( ++ self.assertRegex( + repr(self.msqs), + r"^, using=None>$", +@@ -967,18 +967,18 @@ def test_or_and(self): + class ValuesQuerySetTestCase(SearchQuerySetTestCase): + def test_values_sqs(self): + sqs = self.msqs.auto_query("test").values("id") +- self.assert_(isinstance(sqs, ValuesSearchQuerySet)) ++ self.assertIsInstance(sqs, ValuesSearchQuerySet) + + # We'll do a basic test to confirm that slicing works as expected: +- self.assert_(isinstance(sqs[0], dict)) +- self.assert_(isinstance(sqs[0:5][0], dict)) ++ self.assertIsInstance(sqs[0], dict) ++ self.assertIsInstance(sqs[0:5][0], dict) + + def test_valueslist_sqs(self): + sqs = self.msqs.auto_query("test").values_list("id") + +- self.assert_(isinstance(sqs, ValuesListSearchQuerySet)) +- self.assert_(isinstance(sqs[0], (list, tuple))) +- self.assert_(isinstance(sqs[0:1][0], (list, tuple))) ++ self.assertIsInstance(sqs, ValuesListSearchQuerySet) ++ self.assertIsInstance(sqs[0], (list, tuple)) ++ self.assertIsInstance(sqs[0:1][0], (list, tuple)) + + self.assertRaises( + TypeError, +@@ -989,12 +989,12 @@ def test_valueslist_sqs(self): + ) + + flat_sqs = self.msqs.auto_query("test").values_list("id", flat=True) +- self.assert_(isinstance(sqs, ValuesListSearchQuerySet)) ++ self.assertIsInstance(sqs, ValuesListSearchQuerySet) + + # Note that this will actually be None because a mocked sqs lacks + # anything else: +- self.assert_(flat_sqs[0] is None) +- self.assert_(flat_sqs[0:1][0] is None) ++ self.assertIsNone(flat_sqs[0]) ++ self.assertIsNone(flat_sqs[0:1][0]) + + + class EmptySearchQuerySetTestCase(TestCase):