summaryrefslogtreecommitdiffstats
path: root/python/PyStemmer/python-3.7-compatibility.patch
diff options
context:
space:
mode:
author Nikos Giotis <nikos.giotis@gmail.com>2019-05-04 08:16:01 +0700
committer Willy Sudiarto Raharjo <willysr@slackbuilds.org>2019-05-04 08:16:01 +0700
commit8cb349dc0f3e10f0fa1324504cef6a1bc38c2dae (patch)
treeaff95455786ebef57e76efb65b98b4fcb773acfd /python/PyStemmer/python-3.7-compatibility.patch
parentc2b8b6b83ca6319ae87244c74691a4abbb43d49f (diff)
downloadslackbuilds-8cb349dc0f3e10f0fa1324504cef6a1bc38c2dae.tar.gz
slackbuilds-8cb349dc0f3e10f0fa1324504cef6a1bc38c2dae.tar.xz
python/PyStemmer: Add python3 support.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'python/PyStemmer/python-3.7-compatibility.patch')
-rw-r--r--python/PyStemmer/python-3.7-compatibility.patch66
1 files changed, 66 insertions, 0 deletions
diff --git a/python/PyStemmer/python-3.7-compatibility.patch b/python/PyStemmer/python-3.7-compatibility.patch
new file mode 100644
index 0000000000..aeebafd725
--- /dev/null
+++ b/python/PyStemmer/python-3.7-compatibility.patch
@@ -0,0 +1,66 @@
+From b29ce2109f49c0b82517fa9d3e2bbacc1f8b34ec Mon Sep 17 00:00:00 2001
+From: konstantin <kslavnov@gmail.com>
+Date: Sun, 30 Sep 2018 20:30:07 +0300
+Subject: [PATCH] Fix installation for python 3.7
+
+Changes list:
+- Use setuptools instead of distutils to handle `setup_requires` in `setup()`.
+- Require Cython package for setup and always build `.pyx` to `.c`. It also requires `python-dev` to be installed (see `.travis.yml`).
+---
+ setup.py | 27 +++++++++------------------
+ 1 files changed, 9 insertions(+), 18 deletions(-)
+
+diff --git a/setup.py b/setup.py
+index 5fa89f5..fc53b69 100644
+--- a/setup.py
++++ b/setup.py
+@@ -1,13 +1,13 @@
+ #!/usr/bin/env python
+
+-from distutils.core import setup, Extension
++from setuptools import setup, Extension
+ import os.path
+
+-try:
++
++def build_ext(*args, **kwargs):
+ from Cython.Distutils import build_ext
+- have_pyrex = 1
+-except:
+- have_pyrex = 0
++ return build_ext(*args, **kwargs)
++
+
+ # Directory which libstemmer sources are unpacked in.
+ library_dir = 'libstemmer_c'
+@@ -39,16 +39,8 @@
+ # Set the include path to include libstemmer.
+ include_dirs = ('src', os.path.join(library_dir, 'include'))
+
+-if have_pyrex:
+- # Add the pyrex sources, and a special rule so distutils knows how to
+- # use them.
+- src_files.append('src/Stemmer.pyx')
+- cmdclass = {'build_ext': build_ext}
+-else:
+- # Add just the C sources.
+- src_files.append('src/Stemmer.c')
+- cmdclass = {}
+-
++src_files.append('src/Stemmer.pyx')
++
+ long_description = r"""
+
+ Stemming algorithms
+@@ -125,9 +117,8 @@
+ "Topic :: Text Processing :: Indexing",
+ "Topic :: Text Processing :: Linguistic",
+ ],
+-
++ setup_requires=['Cython>=0.28.5,<1.0'],
+ ext_modules = [Extension('Stemmer', src_files,
+ include_dirs = include_dirs)],
+- cmdclass = cmdclass
++ cmdclass = {'build_ext': build_ext}
+ )
+-