From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marius Bakke Subject: [PATCH 3/6] gnu: Add python-cram. Date: Sun, 15 Jan 2017 21:33:35 +0100 Message-ID: <20170115203338.19769-4-mbakke@fastmail.com> References: <20170115203338.19769-1-mbakke@fastmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57146) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cSrV7-0002fq-P9 for guix-devel@gnu.org; Sun, 15 Jan 2017 15:34:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cSrV6-0002Uw-75 for guix-devel@gnu.org; Sun, 15 Jan 2017 15:34:05 -0500 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:49220) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cSrV6-0002Us-37 for guix-devel@gnu.org; Sun, 15 Jan 2017 15:34:04 -0500 In-Reply-To: <20170115203338.19769-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 Cc: Marius Bakke * gnu/packages/python.scm (python-cram, python2-cram): New variables. --- gnu/packages/python.scm | 64 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index ddf276de0..e61d7d1fb 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -26,7 +26,7 @@ ;;; Copyright © 2016 ng0 ;;; Copyright © 2016 Dylan Jeffers ;;; Copyright © 2016 David Craven -;;; Copyright © 2016 Marius Bakke +;;; Copyright © 2016, 2017 Marius Bakke ;;; Copyright © 2016 Stefan Reichoer ;;; Copyright © 2016 Dylan Jeffers ;;; Copyright © 2016 Alex Vong @@ -6057,6 +6057,68 @@ pseudo terminal (pty), and interact with both the process and its pty.") (define-public python2-ptyprocess (package-with-python2 python-ptyprocess)) +(define-public python-cram + (package + (name "python-cram") + (version "0.7") + (home-page "https://bitheap.org/cram/") + (source (origin + (method url-fetch) + (uri (list (string-append home-page "cram-" + version ".tar.gz") + (pypi-uri "cram" version))) + (sha256 + (base32 + "0bvz6fwdi55rkrz3f50zsy35gvvwhlppki2yml5bj5ffy9d499vx")))) + (arguments + '(#:phases + (modify-phases %standard-phases + (add-after 'unpack 'patch-source + (lambda _ + (substitute* (find-files "cram" ".*\\.py") + ;; Replace default shell path. This is necessary for tests, + ;; and convenient for programs using the main "cram" binary + ;; in environments lacking /bin/sh (e.g. if this program is + ;; used in other builds). + (("/bin/sh") (which "sh"))) + (substitute* (find-files "tests" ".*\\.t") + (("md5") "md5sum") + (("/bin/bash") (which "bash")) + (("/bin/sh") (which "sh"))) + (substitute* "cram/_test.py" + ;; This hack works around a bug triggered by substituting + ;; the /bin/sh paths. "tests/usage.t" compares the output of + ;; "cram -h", which breaks the output at 80 characters. This + ;; causes the line showing the default shell to break into two + ;; lines, but the test expects a single line... + (("env\\['COLUMNS'\\] = '80'") + "env['COLUMNS'] = '160'")) + #t)) + (delete 'check) + (add-after 'install 'check + ;; The test phase uses the built binary and library. + ;; It's easier to run it after install since the build + ;; directory contains version-specific PATH. + (lambda* (#:key inputs outputs #:allow-other-keys) + (add-installed-pythonpath inputs outputs) + (setenv "PATH" (string-append (getenv "PATH") ":" + (assoc-ref outputs "out") "/bin")) + (zero? (system* "make" "test"))))))) + (build-system python-build-system) + (native-inputs + `(("python-coverage" ,python-coverage) + ("which" ,which))) + (synopsis "Simple testing framework for command line applications") + (description + "Cram is a functional testing framework for command line applications. +Cram tests look like snippets of interactive shell sessions. Cram runs each +command and compares the command output in the test with the command’s actual +output.") + (license license:gpl2+))) + +(define-public python2-cram + (package-with-python2 python-cram)) + (define-public python-terminado (package (name "python-terminado") -- 2.11.0