From ed524c01a4e4bc2f520c0adc959908f0d85685d60a692bfd129752b23f72500c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Thu, 18 Jul 2019 08:33:45 +0000 Subject: [PATCH] - Add patch to fix build with pytest4+ (both in git of upstream): * pytest4.patch * py2encoding.patch - Use fdupes - Update URL - Make sure py2 tests are run too OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Whoosh?expand=0&rev=17 --- py2encoding.patch | 57 +++++++++++++++++++++++++++++++++++++++++++ pytest4.patch | 13 ++++++++++ python-Whoosh.changes | 10 ++++++++ python-Whoosh.spec | 20 ++++++++------- 4 files changed, 91 insertions(+), 9 deletions(-) create mode 100644 py2encoding.patch create mode 100644 pytest4.patch diff --git a/py2encoding.patch b/py2encoding.patch new file mode 100644 index 0000000..b181a59 --- /dev/null +++ b/py2encoding.patch @@ -0,0 +1,57 @@ +From f5a777572fb9c91fa10be3c1ffd5f65cc9323653 Mon Sep 17 00:00:00 2001 +From: fortable1999 +Date: Wed, 12 Dec 2018 11:18:50 +0900 +Subject: [PATCH] Fixed test case for ListCorrector; Fixed FSA __eq__ function + +--- + src/whoosh/automata/fsa.py | 7 +------ + tests/test_reading.py | 1 + + tests/test_spelling.py | 7 ++++++- + 5 files changed, 12 insertions(+), 8 deletions(-) + create mode 100644 .gitignore + +diff --git a/src/whoosh/automata/fsa.py b/src/whoosh/automata/fsa.py +index 280ddb50..54d23f2f 100644 +--- a/src/whoosh/automata/fsa.py ++++ b/src/whoosh/automata/fsa.py +@@ -44,12 +44,7 @@ def __eq__(self, other): + return False + st = self.transitions + ot = other.transitions +- if list(st) != list(ot): +- return False +- for key in st: +- if st[key] != ot[key]: +- return False +- return True ++ return st == ot + + def all_states(self): + stateset = set(self.transitions) +diff --git a/tests/test_reading.py b/tests/test_reading.py +index e2c2b71d..9fefc41c 100644 +--- a/tests/test_reading.py ++++ b/tests/test_reading.py +@@ -1,3 +1,4 @@ ++# coding=utf-8 + from __future__ import with_statement + import random, threading, time + +diff --git a/tests/test_spelling.py b/tests/test_spelling.py +index ce5284f1..440c2d02 100644 +--- a/tests/test_spelling.py ++++ b/tests/test_spelling.py +@@ -20,7 +20,12 @@ def test_list_corrector(): + corr = spelling.ListCorrector(_wordlist) + typo = "reoction" + sugs = list(corr.suggest(typo, maxdist=2)) +- target = [w for w in _wordlist if levenshtein(typo, w) <= 2] ++ target = [] ++ for lev_dist in range(1, 3): ++ # sugs will return suggest first ordered by levenshtein distance ++ # then second order by dictionary order ++ target += [w for w in _wordlist ++ if levenshtein(typo, w) <= lev_dist and w not in target] + assert sugs == target + + diff --git a/pytest4.patch b/pytest4.patch new file mode 100644 index 0000000..fb72f88 --- /dev/null +++ b/pytest4.patch @@ -0,0 +1,13 @@ +Index: Whoosh-2.7.4/setup.cfg +=================================================================== +--- Whoosh-2.7.4.orig/setup.cfg ++++ Whoosh-2.7.4/setup.cfg +@@ -15,7 +15,7 @@ formats = zip,gztar + push = sdist bdist_wheel upload + pushdocs = build_sphinx upload_sphinx + +-[pytest] ++[tool:pytest] + addopts = -rs --tb=native + norecursedirs = .hg .tox _build tmp* env* benchmark stress + minversion = 2.0 diff --git a/python-Whoosh.changes b/python-Whoosh.changes index 433daf9..d4c6005 100644 --- a/python-Whoosh.changes +++ b/python-Whoosh.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Thu Jul 18 08:22:32 UTC 2019 - Tomáš Chvátal + +- Add patch to fix build with pytest4+ (both in git of upstream): + * pytest4.patch + * py2encoding.patch +- Use fdupes +- Update URL +- Make sure py2 tests are run too + ------------------------------------------------------------------- Tue Dec 4 12:56:04 UTC 2018 - Matej Cepl diff --git a/python-Whoosh.spec b/python-Whoosh.spec index 4745b72..f39429f 100644 --- a/python-Whoosh.spec +++ b/python-Whoosh.spec @@ -1,7 +1,7 @@ # # spec file for package python-Whoosh # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,23 +17,23 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} -%bcond_without test Name: python-Whoosh Version: 2.7.4 Release: 0 Summary: Pure-Python full text indexing, search, and spell checking library License: BSD-2-Clause Group: Development/Languages/Python -URL: http://www.turbogears.org +URL: https://github.com/whoosh-community/whoosh/ Source: https://files.pythonhosted.org/packages/source/W/Whoosh/Whoosh-%{version}.tar.gz -BuildRequires: %{python_module Sphinx} +Patch0: pytest4.patch +Patch1: py2encoding.patch BuildRequires: %{python_module setuptools} +BuildRequires: fdupes BuildRequires: python-rpm-macros +BuildRequires: python3-Sphinx BuildArch: noarch # SECTION the testing dependencies -%if %{with test} BuildRequires: %{python_module pytest} -%endif # /SECTION %ifpython2 Provides: python-whoosh = %{version} @@ -62,6 +62,7 @@ This package contains the documentation. %prep %setup -q -n Whoosh-%{version} +%autopatch -p1 %build %python_build @@ -69,11 +70,12 @@ sphinx-build -b html -d docs/build/doctrees docs/source docs/build/html %install %python_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} -%if %{with test} %check -%python_exec setup.py test -%endif +export LANG=en_US.UTF8 +# test_list_corrector - depends on dict sorting thats in py3+ only +%pytest -k 'not test_list_corrector' %files %{python_files} %license LICENSE.txt