Sync from SUSE:ALP:Source:Standard:1.0 python-Whoosh revision a3931a6379c8f2738c57d6541edf907e

This commit is contained in:
Adrian Schröter 2023-10-18 22:24:39 +02:00
commit d6e29be7d5
7 changed files with 424 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -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

View File

@ -0,0 +1,16 @@
---
src/whoosh/matching/mcore.py | 3 +++
1 file changed, 3 insertions(+)
--- a/src/whoosh/matching/mcore.py
+++ b/src/whoosh/matching/mcore.py
@@ -379,6 +379,9 @@ class NullMatcherClass(Matcher):
def __repr__(self):
return "<NullMatcher>"
+ def __hash__(self):
+ return hash((self.is_active(), tuple(self.all_ids())))
+
def supports_block_quality(self):
return True

BIN
Whoosh-2.7.4.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

57
py2encoding.patch Normal file
View File

@ -0,0 +1,57 @@
From f5a777572fb9c91fa10be3c1ffd5f65cc9323653 Mon Sep 17 00:00:00 2001
From: fortable1999 <fortable1999@gmail.com>
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

13
pytest4.patch Normal file
View File

@ -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

212
python-Whoosh.changes Normal file
View File

@ -0,0 +1,212 @@
-------------------------------------------------------------------
Wed May 3 10:41:31 UTC 2023 - Dirk Müller <dmueller@suse.com>
- fix line endings
-------------------------------------------------------------------
Tue May 2 05:48:24 UTC 2023 - Daniel Garcia <daniel.garcia@suse.com>
- add sle15_python_module_pythons (jsc#PED-68)
-------------------------------------------------------------------
Sun Apr 23 22:40:43 UTC 2023 - Matej Cepl <mcepl@suse.com>
- Move documentation into the main package for SLE15
-------------------------------------------------------------------
Tue Apr 5 09:38:22 UTC 2022 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>
- Update in SLE-15 (bsc#1197830)
-------------------------------------------------------------------
Mon Jun 21 07:55:58 UTC 2021 - Matej Cepl <mcepl@suse.com>
- Add NullMatcherClass-hashable.patch which adds __hash__
method to NullMatcherClass, so that it works with Sphinx4
(gh#whoosh-community/whoosh#570).
-------------------------------------------------------------------
Thu Jul 18 08:22:32 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- 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 <mcepl@suse.com>
- Remove superfluous devel dependency for noarch package
-------------------------------------------------------------------
Mon Jul 10 10:20:39 UTC 2017 - jengelh@inai.de
- Ensure neutrality of description.
-------------------------------------------------------------------
Mon Jun 26 09:07:38 UTC 2017 - tbechtold@suse.com
- convert to singlespec
- split -doc package
- use files.pythonhosted.org as Source url
- update to 2.7.4:
* Changed version number to 2.7.0.
* Added tag 2.7.0 for changeset 8abeb09483b9
* Results.extend() didn't update the cached length.
* Fixed VarBytesListColumn and FixedBytesListColumn.
* Handle an empty queue exception in mpwriter.
* Merging pull request with local commit.
* Added test for storing tuples.
* Remove caching decorator from VarBytesColumn reader.
* Added test for has_deletions() after an optimization.
* Try to avoid an UnboundLocalError in the DFA when MultiTerm.matcher() has
an empty string.
* Don't try to write a vector if the list of items is empty.
* Implemented use of score_fn argument to NestedParent.
* Don't cache query -> bitset, since this somehow prevents the Searcher from
being collected.
* Changed README docs link to point to readthedocs.org.
* Change uses of dump[s]() to always use protocol 2 instead of -1
("use latest protocol") so indices created with Python 3.x are backwards
compatible.
* Fix the analyzer in test_vector_unicode() to not lowercase, since this
makes the test fail on some Python versions.
* Actually use the split_fn passed by the user. Not sure what happened here.
* Handle pickled Schema objects that don't have a _subfields attribute.
* Added fix and tests for calling expand_prefix() with unicode.
* Fix short code for Swedish in language aliases.
* Fix missing a consecutive token during highlighting
* Added estimate_size() methods to SpanNear2.
* Removed reference to "allfields" keyword argument.
* Added tests/english-words.10.gz to manifest so it's included in the distribution.
* Fix warnings in docs build.
* BufferedWriter should call close() instead of commit() when exiting a context.
* Reinstate fields.IDLIST's analyzer.
* Change the version of my fork to be distinct from the base repo.
* Backed out changeset 96255fc8ff17
* A typo in `whoosh.fields.KEYWORD` documentation
* Created new branch romanian-stemmer
* Skip ISO-8859-1 suffixes on Unicode strings
* Created new branch spanish-tokenizer
* Add sanity check for Spanish stemmer
* Fix sample highlight class
* Reorder the self._tempstorage.destroy() in SegmentWriter._finish to
before the lock is released
* IOError from rmdir is ok if the error was ENOENT
* Fix reporting of total count in FilterCollector, based on PR #63 by Jannon Frank.
* Added a test for pickling a schema with a stemming analyzer.
* Initial unfinished, massive checkin of next-gen architecture.
* Fix forward-compatibility issue for Python 3.x.
* Write offsets in VarBytesColumn when there are more than a certain number of rows.
* Replaced porter stemming algorithm implementation with one based on the one in NLTK.
* Add IDEA's .cache directory to hgignore.
* Add IDEA's .cache directory to hgignore.
* Remove docstring chickenscratch.
* Fix test accidentally left with assert False at the end.
* Removed accidentally committed debug prints.
* Bumped version number for bugfix release.
* Added tag 2.7.1 for changeset 1bd4b9792eed
* Merging Bitbucket and local heads.
* Bumped version number.
* Added tag 2.7.2 for changeset f6bf123ac708
* Fixed logic for checking if floats are all whole in encode_weights.
* Change posting storage so the data from individual posts can be pulled
out as raw bytes.
* Fixed error in CommaSeparatedTokenizer.
* Fixed import error.
* Minor changes.
* Updated VarBytesColumn to store offsets as well as lengths.
* Added context protocol to Index class. Store TOC file name in object.
* Switched to lighter-weight posting block format.
* Forgot to check in pfor.py.
* Reduced size of and references to whoosh.compat, in anticipation of
using 3to2 for most things.
* Remove (object) from class definitions, assuming 3to2 will take care of it.
* Fixed problems from compat refactoring.
* Fixed problem with calling leaf matcher methods on a MultiMatcher.
* Don't encode bytes in _kws_to_query.
* Removed typing annotations to prevent circular import.
* Cleaned up filename generation/checking, added GC step to saving TOC.
* Added header checks in terms and postings files.
* Cleaned up storage cleanup, call it in SegmentWriter.cancel().
* Added another except clause to catch TypeError, because that's what's raised
if you try to pickle a function.
* Fixed error that discarded vector metadata when merging segments.
* Added ability to specify an analyzer in KEYWORD field constructor.
* Bumped version number to 2.7.3.
* Added tag 2.7.3 for changeset f5a1508e93fd
* Added HyphenFilter to collapse hyphenated words into single tokens.
* Have OrGroup.factory() return a real class instead of a function.
* Bumped version number.
-------------------------------------------------------------------
Fri Apr 24 09:45:18 UTC 2015 - cdenicolo@suse.com
- license update: BSD-2-Clause
correct license ist BSD-2-Clause
-------------------------------------------------------------------
Wed Apr 22 11:33:23 UTC 2015 - mcihar@suse.cz
- Update to 2.7.0:
* Removed on-disk word graph implementation of spell checking in favor of much
simpler and faster FSA implementation over the term file.
* Many bug fixes.
* Removed backwards compatibility with indexes created by versions prior to
2.5. You may need to re-index if you are using an old index that hasn't been
updated.
* This is the last 2.x release before a major overhaul that will break backwards
compatibility.
-------------------------------------------------------------------
Wed Jul 23 10:50:40 UTC 2014 - mcihar@suse.cz
- Upgrate to 2.5.7 (no changelog provided)
-------------------------------------------------------------------
Thu Oct 24 11:17:15 UTC 2013 - speilicke@suse.com
- Require python-setuptools instead of distribute (upstreams merged)
-------------------------------------------------------------------
Mon Oct 7 12:26:44 UTC 2013 - mcihar@suse.cz
- build documentation during build
-------------------------------------------------------------------
Mon Oct 7 12:15:05 UTC 2013 - mcihar@suse.cz
- now uses py.test instead of nose for testing
-------------------------------------------------------------------
Mon Oct 7 12:09:27 UTC 2013 - mcihar@suse.cz
- Update to version 2.5.4
+ New index format
+ Better API for index creation
-------------------------------------------------------------------
Wed Jan 30 11:42:20 UTC 2013 - saschpe@suse.de
- Update to version 2.4.1:
+ Fixes issues #242, #257, #261, #262, #263
- Renamed to python-Whoosh, obsoletes python-whoosh
- Install HTML documentation and LICENSE.txt
- Set SPDX-style license
- Run testsuite
-------------------------------------------------------------------
Fri Jun 8 13:33:01 UTC 2012 - highwaystar.ru@gmail.com
- update to 2.4.0
- python3 package added
- a lot of spec improvements
-------------------------------------------------------------------
Mon Apr 16 13:15:09 UTC 2012 - mcihar@suse.cz
- updated to 2.3.2
- make package noarch if possible

100
python-Whoosh.spec Normal file
View File

@ -0,0 +1,100 @@
#
# spec file for package python-Whoosh
#
# Copyright (c) 2023 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-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: https://github.com/whoosh-community/whoosh/
Source: https://files.pythonhosted.org/packages/source/W/Whoosh/Whoosh-%{version}.tar.gz
# upstream in completely unrelated https://github.com/whoosh-community/whoosh/commit/b43e5a432109
Patch0: pytest4.patch
# upstream in https://github.com/whoosh-community/whoosh/commit/f5a777572fb9
Patch1: py2encoding.patch
# PATCH-FIX-UPSTREAM NullMatcherClass-hashable.patch gh#whoosh-community/whoosh#570 mcepl@suse.com
# NullMatcherClass needs __hash__ method as well for Sphinx4 compatiblity.
Patch2: NullMatcherClass-hashable.patch
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildRequires: python3-Sphinx
BuildArch: noarch
# SECTION the testing dependencies
BuildRequires: %{python_module pytest}
# /SECTION
%ifpython2
Provides: python-whoosh = %{version}
Obsoletes: python-whoosh < %{version}
%endif
%python_subpackages
%description
Whoosh is a pure-Python indexing and search library. It can be used
to add search functionality to applications and websites. Every part
of how Whoosh works can be extended or replaced to meet specific
needs.
%if 0%{?suse_version} > 1500
%package -n python-Whoosh-doc
Summary: Documentation for %{name}
Group: Documentation/Other
Provides: %{python_module Whoosh-doc = %{version}}
%description -n python-Whoosh-doc
Whoosh is a pure-Python indexing and search library. It can be used
to add search functionality to applications and websites. Every part
of how Whoosh works can be extended or replaced to meet specific
needs.
This package contains the documentation.
%endif
%prep
%autosetup -p1 -n Whoosh-%{version}
# Fix CRLF->LF
sed -i -e 's/\r$//' docs/source/api/filedb/{filestore,filetables,structfile}.rst
%build
%python_build
sphinx-build -b html -d docs/build/doctrees docs/source docs/build/html
%install
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
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
%doc README.txt
%{python_sitelib}/*
%if 0%{?suse_version} > 1500
%files -n python-Whoosh-doc
%license LICENSE.txt
%endif
%doc docs/build/html
%changelog