summaryrefslogtreecommitdiff
path: root/textproc/py-natsort
diff options
context:
space:
mode:
authorjdolecek <jdolecek@pkgsrc.org>2016-11-30 14:13:48 +0000
committerjdolecek <jdolecek@pkgsrc.org>2016-11-30 14:13:48 +0000
commit9dbae66e4182de09195c6130eb26032753919a33 (patch)
treed9aa06c5558be7fc849a8a2c3d450b835c3e5a22 /textproc/py-natsort
parentd915c0461822a690138b84ac0cb38f592f5435aa (diff)
downloadpkgsrc-9dbae66e4182de09195c6130eb26032753919a33.tar.gz
Add py-natsort 5.0.1 - Natural sorting for Python
based on wip version
Diffstat (limited to 'textproc/py-natsort')
-rw-r--r--textproc/py-natsort/DESCR25
-rw-r--r--textproc/py-natsort/Makefile18
-rw-r--r--textproc/py-natsort/PLIST46
-rw-r--r--textproc/py-natsort/distinfo6
4 files changed, 95 insertions, 0 deletions
diff --git a/textproc/py-natsort/DESCR b/textproc/py-natsort/DESCR
new file mode 100644
index 00000000000..9eef59e1409
--- /dev/null
+++ b/textproc/py-natsort/DESCR
@@ -0,0 +1,25 @@
+When you try to sort a list of strings that contain numbers, the
+normal python sort algorithm sorts lexicographically, so you might
+not get the results that you expect:
+
+>>> a = ['a2', 'a9', 'a1', 'a4', 'a10']
+>>> sorted(a)
+['a1', 'a10', 'a2', 'a4', 'a9']
+
+Notice that it has the order (‘1’, ‘10’, ‘2’) - this is because the
+list is being sorted in lexicographical order, which sorts numbers
+like you would letters (i.e. ‘b’, ‘ba’, ‘c’).
+
+natsort provides a function natsorted that helps sort lists
+“naturally”, either as real numbers (i.e. signed/unsigned floats
+or ints), or as versions. Using natsorted is simple:
+
+>>> from natsort import natsorted
+>>> a = ['a2', 'a9', 'a1', 'a4', 'a10']
+>>> natsorted(a)
+['a1', 'a2', 'a4', 'a9', 'a10']
+
+natsorted identifies numbers anywhere in a string and sorts them
+naturally. Here are some other things you can do with natsort (please
+see the examples for a quick start guide, or the api for more
+details).
diff --git a/textproc/py-natsort/Makefile b/textproc/py-natsort/Makefile
new file mode 100644
index 00000000000..7e0a3c90eee
--- /dev/null
+++ b/textproc/py-natsort/Makefile
@@ -0,0 +1,18 @@
+# $NetBSD: Makefile,v 1.1 2016/11/30 14:13:48 jdolecek Exp $
+
+DISTNAME= natsort-5.0.1
+PKGNAME= ${PYPKGPREFIX}-${DISTNAME}
+CATEGORIES= textproc python
+MASTER_SITES= ${MASTER_SITE_PYPI:=n/natsort/}
+
+MAINTAINER= kamelderouiche@yahoo.com
+HOMEPAGE= https://github.com/SethMMorton/natsort
+COMMENT= Natural sorting for python
+LICENSE= mit
+
+WRKSRC= ${WRKDIR}/natsort-5.0.1
+
+USE_LANGUAGES= # none
+
+.include "../../lang/python/egg.mk"
+.include "../../mk/bsd.pkg.mk" \ No newline at end of file
diff --git a/textproc/py-natsort/PLIST b/textproc/py-natsort/PLIST
new file mode 100644
index 00000000000..3c8bee64a04
--- /dev/null
+++ b/textproc/py-natsort/PLIST
@@ -0,0 +1,46 @@
+@comment $NetBSD: PLIST,v 1.1 2016/11/30 14:13:48 jdolecek Exp $
+bin/natsort
+${PYSITELIB}/${EGG_INFODIR}/PKG-INFO
+${PYSITELIB}/${EGG_INFODIR}/SOURCES.txt
+${PYSITELIB}/${EGG_INFODIR}/dependency_links.txt
+${PYSITELIB}/${EGG_INFODIR}/entry_points.txt
+${PYSITELIB}/${EGG_INFODIR}/top_level.txt
+${PYSITELIB}/natsort/__init__.py
+${PYSITELIB}/natsort/__init__.pyc
+${PYSITELIB}/natsort/__init__.pyo
+${PYSITELIB}/natsort/__main__.py
+${PYSITELIB}/natsort/__main__.pyc
+${PYSITELIB}/natsort/__main__.pyo
+${PYSITELIB}/natsort/_version.py
+${PYSITELIB}/natsort/_version.pyc
+${PYSITELIB}/natsort/_version.pyo
+${PYSITELIB}/natsort/compat/__init__.py
+${PYSITELIB}/natsort/compat/__init__.pyc
+${PYSITELIB}/natsort/compat/__init__.pyo
+${PYSITELIB}/natsort/compat/fake_fastnumbers.py
+${PYSITELIB}/natsort/compat/fake_fastnumbers.pyc
+${PYSITELIB}/natsort/compat/fake_fastnumbers.pyo
+${PYSITELIB}/natsort/compat/fastnumbers.py
+${PYSITELIB}/natsort/compat/fastnumbers.pyc
+${PYSITELIB}/natsort/compat/fastnumbers.pyo
+${PYSITELIB}/natsort/compat/locale.py
+${PYSITELIB}/natsort/compat/locale.pyc
+${PYSITELIB}/natsort/compat/locale.pyo
+${PYSITELIB}/natsort/compat/pathlib.py
+${PYSITELIB}/natsort/compat/pathlib.pyc
+${PYSITELIB}/natsort/compat/pathlib.pyo
+${PYSITELIB}/natsort/compat/py23.py
+${PYSITELIB}/natsort/compat/py23.pyc
+${PYSITELIB}/natsort/compat/py23.pyo
+${PYSITELIB}/natsort/natsort.py
+${PYSITELIB}/natsort/natsort.pyc
+${PYSITELIB}/natsort/natsort.pyo
+${PYSITELIB}/natsort/ns_enum.py
+${PYSITELIB}/natsort/ns_enum.pyc
+${PYSITELIB}/natsort/ns_enum.pyo
+${PYSITELIB}/natsort/unicode_numbers.py
+${PYSITELIB}/natsort/unicode_numbers.pyc
+${PYSITELIB}/natsort/unicode_numbers.pyo
+${PYSITELIB}/natsort/utils.py
+${PYSITELIB}/natsort/utils.pyc
+${PYSITELIB}/natsort/utils.pyo
diff --git a/textproc/py-natsort/distinfo b/textproc/py-natsort/distinfo
new file mode 100644
index 00000000000..8bedf7b8a4d
--- /dev/null
+++ b/textproc/py-natsort/distinfo
@@ -0,0 +1,6 @@
+$NetBSD: distinfo,v 1.1 2016/11/30 14:13:48 jdolecek Exp $
+
+SHA1 (natsort-5.0.1.tar.gz) = 25e8fb806c7667d564d8881d257fc7222803d6ad
+RMD160 (natsort-5.0.1.tar.gz) = 53c8a553c00fad5bb47591fc79a886d98a6eff46
+SHA512 (natsort-5.0.1.tar.gz) = a183558b8a4be6300400b2efed901fb515efce4bb340b3bdda723f6a628aa05ad2f9e1f2c696afa3970e0c82aca47ea597985a1c6c971517ee3bf759f25241bd
+Size (natsort-5.0.1.tar.gz) = 68053 bytes