diff options
author | Marius Bakke <mbakke@fastmail.com> | 2016-09-11 15:07:37 +0100 |
---|---|---|
committer | Leo Famulari <leo@famulari.name> | 2016-09-14 20:56:02 -0400 |
commit | 5467ea6200e7cf9fa57f340849b6ec1becc87b3d (patch) | |
tree | 276e8b14a3abbaa450a3a7e9e659e99617d7e96f /gnu/packages | |
parent | df94a6b57d0e507ca9a03257881445a35310c082 (diff) | |
download | patches-5467ea6200e7cf9fa57f340849b6ec1becc87b3d.tar patches-5467ea6200e7cf9fa57f340849b6ec1becc87b3d.tar.gz |
gnu: Add python-natsort.
* gnu/packages/python.scm (python-natsort, python2-natsort): New variables.
Signed-off-by: Leo Famulari <leo@famulari.name>
Diffstat (limited to 'gnu/packages')
-rw-r--r-- | gnu/packages/python.scm | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index 8c61736a46..0671444ca5 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -10426,3 +10426,52 @@ failures.") (native-inputs `(("python2-setuptools" ,python2-setuptools) ,@(package-native-inputs base)))))) + +(define-public python-natsort + (package + (name "python-natsort") + (version "5.0.1") + (source (origin + (method url-fetch) + (uri (pypi-uri "natsort" version)) + (sha256 + (base32 + "1abld5p4a6n5zjnyw5mi2pv37gqalcybv2brjr2y6l9l2p8v9mja")))) + (build-system python-build-system) + (arguments + `(#:phases + (modify-phases %standard-phases + (add-before 'check 'set-cachedir + ;; Tests require write access to $HOME by default + (lambda _ (setenv "PYTHON_EGG_CACHE" "/tmp") #t))))) + (native-inputs + `(("python-hypothesis" ,python-hypothesis) + ("python-pytest-cache" ,python-pytest-cache) + ("python-pytest-cov" ,python-pytest-cov) + ("python-pytest-flakes" ,python-pytest-flakes) + ("python-pytest-pep8" ,python-pytest-pep8))) + (propagated-inputs ; TODO: Add python-fastnumbers. + `(("python-pyicu" ,python-pyicu))) + (home-page "https://github.com/SethMMorton/natsort") + (synopsis "Natural sorting for python and shell") + (description + "Natsort lets you apply natural sorting on lists instead of +lexicographical. If you use the built-in @code{sorted} method in python +on a list such as @code{['a20', 'a9', 'a1', 'a4', 'a10']}, it would be +returned as @code{['a1', 'a10', 'a20', 'a4', 'a9']}. Natsort provides a +function @code{natsorted} that identifies numbers and sorts them separately +from strings. It can also sort version numbers, real numbers, mixed types +and more, and comes with a shell command @command{natsort} that exposes this +functionality in the command line.") + (license license:expat) + (properties `((python2-variant . ,(delay python2-natsort)))))) + +(define-public python2-natsort + (let ((base (package-with-python2 (strip-python2-variant python-natsort)))) + (package (inherit base) + (native-inputs + `(("python2-setuptools" ,python2-setuptools) + ("python2-pathlib" ,python2-pathlib) + ("python2-mock" ,python2-mock) + ("python2-enum34" ,python2-enum34) + ,@(package-native-inputs base)))))) |