From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marius Bakke Subject: [PATCH 3/3] gnu: Add python-natsort. Date: Sun, 11 Sep 2016 15:07:37 +0100 Message-ID: <20160911140737.24248-3-mbakke@fastmail.com> References: <20160911140737.24248-1-mbakke@fastmail.com> Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57216) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bj5QJ-00089s-Ds for guix-devel@gnu.org; Sun, 11 Sep 2016 10:07:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bj5QG-0000bl-Ch for guix-devel@gnu.org; Sun, 11 Sep 2016 10:07:55 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:51167) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bj5QE-0000X3-3m for guix-devel@gnu.org; Sun, 11 Sep 2016 10:07:52 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 5F38D20589 for ; Sun, 11 Sep 2016 10:07:41 -0400 (EDT) Received: from localhost (169.243.187.81.in-addr.arpa [81.187.243.169]) by mail.messagingengine.com (Postfix) with ESMTPA id 02041F2988 for ; Sun, 11 Sep 2016 10:07:40 -0400 (EDT) In-Reply-To: <20160911140737.24248-1-mbakke@fastmail.com> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org * gnu/packages/python.scm (python-natsort, python2-natsort): New variables. --- gnu/packages/python.scm | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index bd70cb6..f8e25d4 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -10402,3 +10402,52 @@ with pyflakes.") (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)))))) -- 2.9.3