gnu: python-pybedtools: Update to 0.8.0 and fix build.

From 40db2b4eae5ca61a3134cdaf7b156ed1ae9f7415 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sun, 10 Feb 2019 23:39:25 -0500
Subject: [PATCH] gnu: python-pybedtools: Update to 0.8.0 and fix build.

* gnu/packages/bioinformatics.scm (python-pybedtools): Update to 0.8.0.
[phases]{disable-broken-tests}: Do not disable "test_issue_157" and
"test_to_dataframe" tests.  Disable the "test_getting_example_beds".
{remove-cython-generated-files}: Add phase.
{generate-cython-extensions}: Add phase.
{check}: Move from python2-pybedtools to here.  Add a scripts
subdirectory of the build directory to the PATH, so that the tests can call
them.  Invoke pytest rather than nosetests.
[modules]: Move from python2-pybedtools to here.
[propagated-inputs]: Depend on the current BEDTOOLS rather than version 1.26.
[native-inputs]: Replace python-nose by python-pytest and add python-psutil.
This commit is contained in:
Maxim Cournoyer 2019-02-12 10:32:03 -05:00 committed by Ricardo Wurmus
parent b856a78c94
commit 155194d97d
No known key found for this signature in database
GPG Key ID: 197A5888235FACAC
1 changed files with 66 additions and 46 deletions

View File

@ -12,6 +12,7 @@
;;; Copyright © 2018 Joshua Sierles, Nextjournal <joshua@nextjournal.com> ;;; Copyright © 2018 Joshua Sierles, Nextjournal <joshua@nextjournal.com>
;;; Copyright © 2018 Gábor Boskovits <boskovits@gmail.com> ;;; Copyright © 2018 Gábor Boskovits <boskovits@gmail.com>
;;; Copyright © 2018 Mădălin Ionel Patrașcu <madalinionel.patrascu@mdc-berlin.de> ;;; Copyright © 2018 Mădălin Ionel Patrașcu <madalinionel.patrascu@mdc-berlin.de>
;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -612,16 +613,22 @@ intended to behave exactly the same as the original BWK awk.")
(define-public python-pybedtools (define-public python-pybedtools
(package (package
(name "python-pybedtools") (name "python-pybedtools")
(version "0.7.10") (version "0.8.0")
(source (origin (source (origin
(method url-fetch) (method url-fetch)
(uri (pypi-uri "pybedtools" version)) (uri (pypi-uri "pybedtools" version))
(sha256 (sha256
(base32 (base32
"0l2b2wrnj85azfqgr0zwr60f7j58vlla1hcgxvr9rwikpl8j72ji")))) "1xl454ijvd4dzfvqgfahad49b49j7qy710fq9xh1rvk42z6x5ssf"))))
(build-system python-build-system) (build-system python-build-system)
(arguments (arguments
`(#:phases `(#:modules ((ice-9 ftw)
(srfi srfi-1)
(srfi srfi-26)
(guix build utils)
(guix build python-build-system))
;; See https://github.com/daler/pybedtools/issues/192
#:phases
(modify-phases %standard-phases (modify-phases %standard-phases
;; See https://github.com/daler/pybedtools/issues/261 ;; See https://github.com/daler/pybedtools/issues/261
(add-after 'unpack 'disable-broken-tests (add-after 'unpack 'disable-broken-tests
@ -631,21 +638,59 @@ intended to behave exactly the same as the original BWK awk.")
(substitute* "pybedtools/test/test_scripts.py" (substitute* "pybedtools/test/test_scripts.py"
(("def test_venn_mpl") (("def test_venn_mpl")
"def _do_not_test_venn_mpl")) "def _do_not_test_venn_mpl"))
;; Requires internet access.
(substitute* "pybedtools/test/test_helpers.py" (substitute* "pybedtools/test/test_helpers.py"
;; Requires internet access.
(("def test_chromsizes") (("def test_chromsizes")
"def _do_not_test_chromsizes")) "def _do_not_test_chromsizes")
;; FIXME: these two fail for no good reason. ;; Broken as a result of the workaround used in the check phase
(substitute* "pybedtools/test/test1.py" ;; (see: https://github.com/daler/pybedtools/issues/192).
(("def test_issue_157") (("def test_getting_example_beds")
"def _do_not_test_issue_157") "def _do_not_test_getting_example_beds"))
(("def test_to_dataframe") #t))
"def _do_not_test_to_dataframe")) ;; TODO: Remove phase after it's part of PYTHON-BUILD-SYSTEM.
#t))))) ;; build system.
;; Force the Cythonization of C++ files to guard against compilation
;; problems.
(add-after 'unpack 'remove-cython-generated-files
(lambda _
(let ((cython-sources (map (cut string-drop-right <> 4)
(find-files "." "\\.pyx$")))
(c/c++-files (find-files "." "\\.(c|cpp|cxx)$")))
(define (strip-extension filename)
(string-take filename (string-index-right filename #\.)))
(define (cythonized? c/c++-file)
(member (strip-extension c/c++-file) cython-sources))
(for-each delete-file (filter cythonized? c/c++-files))
#t)))
(add-after 'remove-cython-generated-files 'generate-cython-extensions
(lambda _
(invoke "python" "setup.py" "cythonize")))
(replace 'check
(lambda _
(let* ((cwd (getcwd))
(build-root-directory (string-append cwd "/build/"))
(build (string-append
build-root-directory
(find (cut string-prefix? "lib" <>)
(scandir (string-append
build-root-directory)))))
(scripts (string-append
build-root-directory
(find (cut string-prefix? "scripts" <>)
(scandir build-root-directory)))))
(setenv "PYTHONPATH"
(string-append build ":" (getenv "PYTHONPATH")))
;; Executable scripts such as 'intron_exon_reads.py' must be
;; available in the PATH.
(setenv "PATH"
(string-append scripts ":" (getenv "PATH"))))
;; The tests need to be run from elsewhere...
(mkdir-p "/tmp/test")
(copy-recursively "pybedtools/test" "/tmp/test")
(with-directory-excursion "/tmp/test"
(invoke "pytest")))))))
(propagated-inputs (propagated-inputs
;; Tests don't pass with Bedtools 2.27.1. `(("bedtools" ,bedtools)
;; See https://github.com/daler/pybedtools/issues/260
`(("bedtools" ,bedtools-2.26)
("samtools" ,samtools) ("samtools" ,samtools)
("python-matplotlib" ,python-matplotlib) ("python-matplotlib" ,python-matplotlib)
("python-pysam" ,python-pysam) ("python-pysam" ,python-pysam)
@ -654,9 +699,11 @@ intended to behave exactly the same as the original BWK awk.")
`(("python-numpy" ,python-numpy) `(("python-numpy" ,python-numpy)
("python-pandas" ,python-pandas) ("python-pandas" ,python-pandas)
("python-cython" ,python-cython) ("python-cython" ,python-cython)
("python-nose" ,python-nose) ("kentutils" ,kentutils) ; for bedGraphToBigWig
("kentutils" ,kentutils) ; for bedGraphToBigWig ("python-six" ,python-six)
("python-six" ,python-six))) ;; For the test suite.
("python-pytest" ,python-pytest)
("python-psutil" ,python-psutil)))
(home-page "https://pythonhosted.org/pybedtools/") (home-page "https://pythonhosted.org/pybedtools/")
(synopsis "Python wrapper for BEDtools programs") (synopsis "Python wrapper for BEDtools programs")
(description (description
@ -667,34 +714,7 @@ Python.")
(license license:gpl2+))) (license license:gpl2+)))
(define-public python2-pybedtools (define-public python2-pybedtools
(let ((pkg (package-with-python2 python-pybedtools))) (package-with-python2 python-pybedtools))
(package (inherit pkg)
(arguments
`(#:modules ((ice-9 ftw)
(srfi srfi-1)
(srfi srfi-26)
(guix build utils)
(guix build python-build-system))
;; See https://github.com/daler/pybedtools/issues/192
,@(substitute-keyword-arguments (package-arguments pkg)
((#:phases phases)
`(modify-phases ,phases
(replace 'check
(lambda _
(let ((cwd (getcwd)))
(setenv "PYTHONPATH"
(string-append cwd "/build/"
(find (cut string-prefix? "lib" <>)
(scandir (string-append cwd "/build")))
":" (getenv "PYTHONPATH"))))
;; The tests need to be run from elsewhere...
(mkdir-p "/tmp/test")
(copy-recursively "pybedtools/test" "/tmp/test")
(with-directory-excursion "/tmp/test"
(invoke "nosetests"
;; This test fails for unknown reasons
"--exclude=.*test_getting_example_beds"))
#t))))))))))
(define-public python-biom-format (define-public python-biom-format
(package (package