diff options
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 |
commit | 8cb349dc0f3e10f0fa1324504cef6a1bc38c2dae (patch) | |
tree | aff95455786ebef57e76efb65b98b4fcb773acfd | |
parent | c2b8b6b83ca6319ae87244c74691a4abbb43d49f (diff) | |
download | slackbuilds-8cb349dc0f3e10f0fa1324504cef6a1bc38c2dae.tar.gz |
python/PyStemmer: Add python3 support.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
-rw-r--r-- | python/PyStemmer/PyStemmer.SlackBuild | 10 | ||||
-rw-r--r-- | python/PyStemmer/PyStemmer.info | 4 | ||||
-rw-r--r-- | python/PyStemmer/python-3.7-compatibility.patch | 66 | ||||
-rw-r--r-- | python/PyStemmer/slack-desc | 2 |
4 files changed, 78 insertions, 4 deletions
diff --git a/python/PyStemmer/PyStemmer.SlackBuild b/python/PyStemmer/PyStemmer.SlackBuild index ac8310efe6..365e5933ab 100644 --- a/python/PyStemmer/PyStemmer.SlackBuild +++ b/python/PyStemmer/PyStemmer.SlackBuild @@ -24,7 +24,7 @@ PRGNAM=PyStemmer VERSION=${VERSION:-1.3.0} -BUILD=${BUILD:-1} +BUILD=${BUILD:-2} TAG=${TAG:-_SBo} if [ -z "$ARCH" ]; then @@ -62,6 +62,11 @@ cd $TMP rm -rf $PRGNAM-$VERSION tar xvf $CWD/$PRGNAM-$VERSION.tar.gz cd $PRGNAM-$VERSION + +# Patch for python 3.7 compatibility +# https://github.com/snowballstem/pystemmer/pull/21/commits/b29ce2109f49c0b82517fa9d3e2bbacc1f8b34ec +patch < $CWD/python-3.7-compatibility.patch + chown -R root:root . find -L . \ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ @@ -71,6 +76,9 @@ find -L . \ python setup.py install --root=$PKG +#CFLAGS="$SLKCFLAGS" \ +python3 setup.py install --root=$PKG + find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true diff --git a/python/PyStemmer/PyStemmer.info b/python/PyStemmer/PyStemmer.info index 8b0607a730..85735700e2 100644 --- a/python/PyStemmer/PyStemmer.info +++ b/python/PyStemmer/PyStemmer.info @@ -1,10 +1,10 @@ PRGNAM="PyStemmer" VERSION="1.3.0" -HOMEPAGE="http://snowball.tartarus.org/" +HOMEPAGE="https://snowballstem.org/" DOWNLOAD="https://pypi.python.org/packages/21/ee/19e0e4ec9398cc022617baa5f013fd415cce4887748245126aa6d4fac3c6/PyStemmer-1.3.0.tar.gz" MD5SUM="46ee623eeeba5a7cc0d95cbfa7e18abd" DOWNLOAD_x86_64="" MD5SUM_x86_64="" -REQUIRES="" +REQUIRES="python3-Cython" MAINTAINER="Nikos Giotis" EMAIL="nikos.giotis@gmail.com" 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} + ) +- diff --git a/python/PyStemmer/slack-desc b/python/PyStemmer/slack-desc index 41ee88af53..2f7c7a5581 100644 --- a/python/PyStemmer/slack-desc +++ b/python/PyStemmer/slack-desc @@ -16,4 +16,4 @@ PyStemmer: and information retrieval software; for example, a search with PyStemmer: stemming enabled should be able to find a document containing PyStemmer: "cycling" given the query "cycles". PyStemmer: -PyStemmer: http://snowball.tartarus.org/ +PyStemmer: http://snowballstem.org/ |