Accepting request 1160467 from home:bnavigator:branches:devel:languages:python

- Update to 3.8.1
  * Resolve RCE & XSS vulnerabilities in localhost WordNet Browser
  * Add Python 3.11 support
- Update nltk_data archive
- Drop port-2to3.patch
- Add nltk-pr3207-py312.patch for Python 3.12 support
  * gh#nltk/nltk#3207

OBS-URL: https://build.opensuse.org/request/show/1160467
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-nltk?expand=0&rev=45
This commit is contained in:
Daniel Garcia 2024-03-22 06:59:49 +00:00 committed by Git OBS Bridge
parent 3547d0cab5
commit f64d1a206e
8 changed files with 1858 additions and 85 deletions

3
nltk-3.8.1.zip Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1834da3d0682cba4f2cede2f9aad6b0fafb6461ba451db0efb6f9c39798d64d3
size 4620388

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:74b30826a37d78d53427105bbd037dd880251be269fca64ee530838a46ed55fc
size 4619825

1782
nltk-pr3207-py312.patch Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:f41383a4774bf7227f4563f46543460ba07a6921f7bcc6185519e87ea9e4323f oid sha256:f79462ac99f414b4850943720bed4a59c1bb15bfc8f1ce16b26165da6db07680
size 453871052 size 393271816

View File

@ -1,48 +0,0 @@
---
nltk_data/corpora/pl196x/splitter.py | 4 ++--
nltk_data/taggers/universal_tagset/universal_tags.py | 5 -----
tools/find_deprecated.py | 2 +-
3 files changed, 3 insertions(+), 8 deletions(-)
--- a/nltk_data/corpora/pl196x/splitter.py
+++ b/nltk_data/corpora/pl196x/splitter.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
import sys, re
@@ -7,7 +7,7 @@ TEXTID = re.compile(r'<text id="(.*)">')
if __name__ == '__main__':
if len(sys.argv) != 2:
- print 'One argument required: a pl196x corpus to split.'
+ print('One argument required: a pl196x corpus to split.')
sys.exit()
inputFileName = sys.argv[1]
--- a/nltk_data/taggers/universal_tagset/universal_tags.py
+++ b/nltk_data/taggers/universal_tagset/universal_tags.py
@@ -22,11 +22,6 @@ X - other: foreign words, typos, abbrevi
@author: Nathan Schneider (nschneid)
@since: 2011-05-06
'''
-
-# Strive towards Python 3 compatibility
-from __future__ import print_function, unicode_literals, division
-from future_builtins import map, filter
-
import re, glob
from collections import defaultdict
--- a/tools/find_deprecated.py
+++ b/tools/find_deprecated.py
@@ -29,7 +29,7 @@ import textwrap
import tokenize
from doctest import DocTestParser, register_optionflag
-from cStringIO import StringIO
+from io import StringIO
import nltk.corpus
from nltk import defaultdict

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Thu Mar 21 17:41:52 UTC 2024 - Ben Greiner <code@bnavigator.de>
- Update to 3.8.1
* Resolve RCE & XSS vulnerabilities in localhost WordNet Browser
* Add Python 3.11 support
- Update nltk_data archive
- Drop port-2to3.patch
- Add nltk-pr3207-py312.patch for Python 3.12 support
* gh#nltk/nltk#3207
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Mar 28 08:36:04 UTC 2023 - pgajdos@suse.com Tue Mar 28 08:36:04 UTC 2023 - pgajdos@suse.com

View File

@ -1 +1,2 @@
addFilter("E: zero-length /usr/lib/python3\.\d/site-packages/nltk/tbl/api\.py") addFilter("E: zero-length /usr/lib/python3\.\d+/site-packages/nltk/tbl/api\.py")
addFilter("explicit-lib-dependency python3\d*-joblib")

View File

@ -1,7 +1,7 @@
# #
# spec file for package python-nltk # spec file for package python-nltk
# #
# Copyright (c) 2023 SUSE LLC # Copyright (c) 2024 SUSE LLC
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -16,55 +16,86 @@
# #
%{!?python_module:%define python_module() python-%{**} python3-%{**}}
%define pyname nltk
%define skip_python2 1
Name: python-nltk Name: python-nltk
Version: 3.8 Version: 3.8.1
Release: 0 Release: 0
Summary: Natural Language Toolkit Summary: Natural Language Toolkit
License: Apache-2.0 License: Apache-2.0
URL: http://nltk.org/ URL: http://nltk.org/
Source0: https://files.pythonhosted.org/packages/source/n/nltk/%{pyname}-%{version}.zip # SourceRepository: https://github.com/nltk/nltk
# Downloaded NLTK data via python3 -m nltk.downloader, Source0: https://files.pythonhosted.org/packages/source/n/nltk/nltk-%{version}.zip
# then unzip downloaded zip archive. # Download/Update NLTK data:
# quilt setup python-nltk.spec
# pushd nltk-?.?.?
# python3 -m nltk.downloader -d nltk_data tests \
# averaged_perceptron_tagger_ru \
# brown \
# cess_cat \
# cess_esp \
# conll2007 \
# floresta \
# gutenberg \
# inaugural \
# indian \
# large_grammars \
# nombank.1.0 \
# omw-1.4 \
# pl196x \
# ptb \
# punkt \
# rte \
# sinica_treebank \
# stopwords \
# treebank \
# udhr \
# universal_tagset \
# wordnet \
# wordnet_ic \
# words
# tar -cJf ../nltk_data.tar.xz nltk_data
# popd
# see https://www.nltk.org/data.html for more details # see https://www.nltk.org/data.html for more details
Source1: nltk_data.tar.xz Source1: nltk_data.tar.xz
Source99: python-nltk.rpmlintrc Source99: python-nltk.rpmlintrc
# PATCH-FIX-UPSTREAM skip-networked-test.patch gh#nltk/nltk#2969 mcepl@suse.com # PATCH-FIX-UPSTREAM skip-networked-test.patch gh#nltk/nltk#2969 mcepl@suse.com
# skip tests requiring network connection # skip tests requiring network connection
Patch0: skip-networked-test.patch Patch0: skip-networked-test.patch
# PATCH-FIX-UPSTREAM port-2to3.patch bsc#[0-9]+ mcepl@suse.com # PATCH-FIX-UPSTREAM nltk-pr3207-py312.patch gh#nltk/nltk#3207
# port scripts in nltk_data to Python 3 Patch1: nltk-pr3207-py312.patch
Patch1: port-2to3.patch BuildRequires: %{python_module base >= 3.7}
BuildRequires: %{python_module regex} BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools} BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: %{pythons} BuildRequires: %{pythons}
BuildRequires: fdupes BuildRequires: fdupes
BuildRequires: python-rpm-macros BuildRequires: python-rpm-macros
BuildRequires: unzip BuildRequires: unzip
# For testing # SECTION runtime
BuildRequires: %{python_module tk} BuildRequires: %{python_module regex >= 2021.8.3}
BuildRequires: %{python_module click} BuildRequires: %{python_module click}
BuildRequires: %{python_module pytest}
# BuildRequires: %%{python_module gensim}
BuildRequires: %{python_module joblib} BuildRequires: %{python_module joblib}
BuildRequires: %{python_module tqdm}
# /SECTION
# SECTION test
BuildRequires: %{python_module tk}
BuildRequires: %{python_module Jinja2} BuildRequires: %{python_module Jinja2}
BuildRequires: %{python_module matplotlib} BuildRequires: %{python_module matplotlib}
BuildRequires: %{python_module numpy} BuildRequires: %{python_module numpy}
BuildRequires: %{python_module pyparsing} BuildRequires: %{python_module pyparsing}
BuildRequires: %{python_module pytest-cov} BuildRequires: %{python_module pytest-cov}
BuildRequires: %{python_module pytest-mock} BuildRequires: %{python_module pytest-mock}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module python-crfsuite} BuildRequires: %{python_module python-crfsuite}
BuildRequires: %{python_module regex}
BuildRequires: %{python_module requests} BuildRequires: %{python_module requests}
BuildRequires: %{python_module scikit-learn} BuildRequires: %{python_module scikit-learn}
BuildRequires: %{python_module scipy} BuildRequires: %{python_module scipy}
BuildRequires: %{python_module text-unidecode} BuildRequires: %{python_module text-unidecode}
BuildRequires: %{python_module tqdm}
BuildRequires: %{python_module twython} BuildRequires: %{python_module twython}
# # /SECTION
Requires: python-regex Requires: python-regex >= 2021.8.3
Requires: python-click
Requires: python-joblib
Requires: python-tqdm
Recommends: python-gensim Recommends: python-gensim
Recommends: python-matplotlib Recommends: python-matplotlib
Recommends: python-numpy Recommends: python-numpy
@ -87,10 +118,7 @@ Python modules, data sets and tutorials supporting research and
development in Natural Language Processing. development in Natural Language Processing.
%prep %prep
%autosetup -p1 -a1 -n %{pyname}-%{version} %autosetup -p1 -a1 -n nltk-%{version}
# Remove obsolete scripts
rm tools/nltk_term_index.py tools/run_doctests.py nltk_data/corpora/semcor/semcor.py
# Fix EOL # Fix EOL
sed -i 's/\r/\n/g; s/\n$//' \ sed -i 's/\r/\n/g; s/\n$//' \
@ -120,14 +148,13 @@ sed -E -i "s|#![[:space:]]*%{_bindir}/env python|#!%{_bindir}/python3|" \
setup.py \ setup.py \
tools/global_replace.py \ tools/global_replace.py \
nltk_data/corpora/pl196x/splitter.py \ nltk_data/corpora/pl196x/splitter.py \
tools/find_deprecated.py \ tools/find_deprecated.py
tools/svnmime.py
%build %build
%python_build %pyproject_wheel
%install %install
%python_install %pyproject_install
%python_clone -a %{buildroot}%{_bindir}/nltk %python_clone -a %{buildroot}%{_bindir}/nltk
%{python_expand %fdupes %{buildroot}%{$python_sitelib}/ %{python_expand %fdupes %{buildroot}%{$python_sitelib}/
@ -148,8 +175,8 @@ export NLTK_DATA=$(readlink -f ./nltk_data/)
%files %{python_files} %files %{python_files}
%doc README.md %doc README.md
%license LICENSE.txt %license LICENSE.txt
%{python_sitelib}/%{pyname}/ %{python_sitelib}/nltk/
%{python_sitelib}/%{pyname}-%{version}-py%{python_version}.egg-info/ %{python_sitelib}/nltk-%{version}.dist-info/
%python_alternative %{_bindir}/nltk %python_alternative %{_bindir}/nltk
%changelog %changelog