all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH 0/3] gnu: python2-pbcore: Update to 1.2.10.
@ 2016-09-17 10:10 Marius Bakke
  2016-09-17 10:10 ` [PATCH 1/3] gnu: python-pysam: Update to 0.9.1.4 Marius Bakke
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Marius Bakke @ 2016-09-17 10:10 UTC (permalink / raw)
  To: guix-devel

These patches are necessary to update pbcore to the latest release.
I've verified that all dependents of pysam and pbcore builds fine.

This is part of an effort to package the PacBio GenomicConsensus tools.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 1/3] gnu: python-pysam: Update to 0.9.1.4.
  2016-09-17 10:10 [PATCH 0/3] gnu: python2-pbcore: Update to 1.2.10 Marius Bakke
@ 2016-09-17 10:10 ` Marius Bakke
  2016-09-17 10:10 ` [PATCH 2/3] gnu: Add python-pyxb Marius Bakke
  2016-09-17 10:10 ` [PATCH 3/3] gnu: python2-pbcore: Update to 1.2.10 Marius Bakke
  2 siblings, 0 replies; 18+ messages in thread
From: Marius Bakke @ 2016-09-17 10:10 UTC (permalink / raw)
  To: guix-devel; +Cc: Marius Bakke

* gnu/packages/bioinformatics.scm (python-pysam, python2-pysam): Update
to 0.9.1.4.
---
 gnu/packages/bioinformatics.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index 39a420a..cfd098c 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -1269,13 +1269,13 @@ multiple sequence alignments.")
 (define-public python-pysam
   (package
     (name "python-pysam")
-    (version "0.8.4")
+    (version "0.9.1.4")
     (source (origin
               (method url-fetch)
               (uri (pypi-uri "pysam" version))
               (sha256
                (base32
-                "1slx5mb94mzm5qzk52q270sab0sar95j67w1g1k452nz3s9j7krh"))))
+                "1i1djacqbr88y7w18b4aa78zxnsyr4sz7yqdq2spi7gs0y6pzvjn"))))
     (build-system python-build-system)
     (arguments
      `(#:tests? #f ; tests are excluded in the manifest
-- 
2.10.0

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 2/3] gnu: Add python-pyxb.
  2016-09-17 10:10 [PATCH 0/3] gnu: python2-pbcore: Update to 1.2.10 Marius Bakke
  2016-09-17 10:10 ` [PATCH 1/3] gnu: python-pysam: Update to 0.9.1.4 Marius Bakke
@ 2016-09-17 10:10 ` Marius Bakke
       [not found]   ` <3bd16b58-b3d1-d47c-2433-c3a721681463@uq.edu.au>
  2016-09-17 10:10 ` [PATCH 3/3] gnu: python2-pbcore: Update to 1.2.10 Marius Bakke
  2 siblings, 1 reply; 18+ messages in thread
From: Marius Bakke @ 2016-09-17 10:10 UTC (permalink / raw)
  To: guix-devel; +Cc: Marius Bakke

* gnu/packages/xml.scm (python-pyxb, python2-pyxb): New variables.
---
 gnu/packages/xml.scm | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/gnu/packages/xml.scm b/gnu/packages/xml.scm
index 7befad5..793cd2f 100644
--- a/gnu/packages/xml.scm
+++ b/gnu/packages/xml.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is>
 ;;; Copyright © 2016 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2016 Marius Bakke <mbakke@fastmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -729,6 +730,42 @@ different Unicode encodings which happen automatically during
 parsing/saving.")
     (license license:expat)))
 
+(define-public python-pyxb
+  (package
+    (name "python-pyxb")
+    (version "1.2.4")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "PyXB" version))
+              (sha256
+               (base32
+                "0sgs184mq218li5qqi906hm55zkpqbiyinv9wk6qgqgx813rskq2"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'fix-tests
+           (lambda _
+             ;; See https://github.com/pabigot/pyxb/issues/26 ...
+             (delete-file "tests/trac/test-trac-0091.py")
+             ;; ...and https://github.com/pabigot/pyxb/pull/58 .
+             (substitute* "tests/utils/test-utility.py"
+               (("__NoExt_re = re.compile.*$")
+                "__NoExt_re = re.compile('(^|\\%s)[^\\.]+$' % os.sep)\n"))
+             #t)))))
+    (home-page "http://pyxb.sourceforge.net/")
+    (synopsis "Python XML Schema Bindings")
+    (description
+     "PyXB (\"pixbee\") is a pure Python package that generates Python source
+code for classes that correspond to data structures defined by XMLSchema.")
+    (license (list license:asl2.0    ; Most files.
+                   license:expat     ; pyxb/utils/six.py
+                   license:gpl2      ; bundled jquery in doc is dual MIT/GPL2
+                   license:psfl))))  ; pyxb/utils/activestate.py
+
+(define-public python2-pyxb
+  (package-with-python2 python-pyxb))
+
 (define-public xmlto
   (package
     (name "xmlto")
-- 
2.10.0

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 3/3] gnu: python2-pbcore: Update to 1.2.10.
  2016-09-17 10:10 [PATCH 0/3] gnu: python2-pbcore: Update to 1.2.10 Marius Bakke
  2016-09-17 10:10 ` [PATCH 1/3] gnu: python-pysam: Update to 0.9.1.4 Marius Bakke
  2016-09-17 10:10 ` [PATCH 2/3] gnu: Add python-pyxb Marius Bakke
@ 2016-09-17 10:10 ` Marius Bakke
  2 siblings, 0 replies; 18+ messages in thread
From: Marius Bakke @ 2016-09-17 10:10 UTC (permalink / raw)
  To: guix-devel; +Cc: Marius Bakke

* gnu/packages/bioinformatics.scm (python2-pbcore): Update to 1.2.10.
[propagated-inputs]: New field. Add python2-pyxb.
---
 gnu/packages/bioinformatics.scm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index cfd098c..3d38042 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -3353,13 +3353,13 @@ interrupted by stop codons.  OrfM finds and prints these ORFs.")
 (define-public python2-pbcore
   (package
     (name "python2-pbcore")
-    (version "1.2.8")
+    (version "1.2.10")
     (source (origin
               (method url-fetch)
               (uri (pypi-uri "pbcore" version))
               (sha256
                (base32
-                "02pfn5raa3zf739672bg0dkx7z3j2c4nx7vmpfjqy5b12jrqpymk"))))
+                "1kjmv891d6qbpp4shhhvkl02ff4q5xlpnls2513sm2cjcrs52f1i"))))
     (build-system python-build-system)
     (arguments `(#:python ,python-2)) ; pbcore requires Python 2.7
     (inputs
@@ -3372,6 +3372,8 @@ interrupted by stop codons.  OrfM finds and prints these ORFs.")
        ("python-nose" ,python2-nose)
        ("python-setuptools" ,python2-setuptools)
        ("python-sphinx" ,python2-sphinx)))
+    (propagated-inputs
+     `(("python-pyxb" ,python2-pyxb)))
     (home-page "http://pacificbiosciences.github.io/pbcore/")
     (synopsis "Library for reading and writing PacBio data files")
     (description
-- 
2.10.0

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/3] gnu: Add python-pyxb.
       [not found]   ` <3bd16b58-b3d1-d47c-2433-c3a721681463@uq.edu.au>
@ 2016-09-20  6:34     ` Ben Woodcroft
  2016-09-20  7:06       ` Ben Woodcroft
  0 siblings, 1 reply; 18+ messages in thread
From: Ben Woodcroft @ 2016-09-20  6:34 UTC (permalink / raw)
  To: Marius Bakke, guix-devel@gnu.org

Oops, forgot to cc the list.


On 20/09/16 16:02, Ben Woodcroft wrote:
> Hi Marius,
>
> Thanks for the patches.
>
> On 17/09/16 20:10, Marius Bakke wrote:
>> [..]
>> +         (add-after 'unpack 'fix-tests
>> +           (lambda _
>> +             ;; See https://github.com/pabigot/pyxb/issues/26 ...
>> +             (delete-file "tests/trac/test-trac-0091.py")
>
> The fix for that test failing seems straightforward enough, might be 
> better to include as a patch so those tests are run.
> https://github.com/pabigot/pyxb/commit/d4bdd5a1c712cd70f96264ae13b55d015cbf3335 
>
>
>> +             ;; ...and https://github.com/pabigot/pyxb/pull/58 .
>> +             (substitute* "tests/utils/test-utility.py"
>> +               (("__NoExt_re = re.compile.*$")
>> +                "__NoExt_re = re.compile('(^|\\%s)[^\\.]+$' % 
>> os.sep)\n"))
>
> Good catch there. It would be preferable to add this change as a patch 
> as well, because it is more likely to apply correctly (not that it 
> won't here), and also because when it is no longer needed after this 
> package gets updated the patch will fail to apply alerting the updater 
> to the fact it should be removed. As a bonus, my experience is that 
> working with patches easier than using substitute* so require less 
> builds before getting to a happy package.
>
> I have not actually built these packages, but they look fine 
> otherwise. Would you mind sending an updated patch for pyxb, and then 
> I'll probably apply all three (assuming I find nothing else, which I 
> don't anticipate).
>
> Thanks,
> ben

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/3] gnu: Add python-pyxb.
  2016-09-20  6:34     ` Ben Woodcroft
@ 2016-09-20  7:06       ` Ben Woodcroft
  2016-09-21 21:14         ` Marius Bakke
  0 siblings, 1 reply; 18+ messages in thread
From: Ben Woodcroft @ 2016-09-20  7:06 UTC (permalink / raw)
  To: Marius Bakke, guix-devel@gnu.org

Hi again,


On 20/09/16 16:34, Ben Woodcroft wrote:
> Oops, forgot to cc the list.
>
>
> On 20/09/16 16:02, Ben Woodcroft wrote:
>> Hi Marius,
>>
>> Thanks for the patches.
>>
>> On 17/09/16 20:10, Marius Bakke wrote:
>>> [..]
>>> +         (add-after 'unpack 'fix-tests
>>> +           (lambda _
>>> +             ;; See https://github.com/pabigot/pyxb/issues/26 ...
>>> +             (delete-file "tests/trac/test-trac-0091.py")
>>
>> The fix for that test failing seems straightforward enough, might be 
>> better to include as a patch so those tests are run.
>> https://github.com/pabigot/pyxb/commit/d4bdd5a1c712cd70f96264ae13b55d015cbf3335 
>>
Actually, 1.2.5 just got released which has both of these fixes. Can you 
send an updated patch please?

Thanks.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/3] gnu: Add python-pyxb.
  2016-09-20  7:06       ` Ben Woodcroft
@ 2016-09-21 21:14         ` Marius Bakke
  2016-09-22  0:46           ` Ben Woodcroft
  0 siblings, 1 reply; 18+ messages in thread
From: Marius Bakke @ 2016-09-21 21:14 UTC (permalink / raw)
  To: Ben Woodcroft, guix-devel@gnu.org

[-- Attachment #1: Type: text/plain, Size: 890 bytes --]

Ben Woodcroft <b.woodcroft@uq.edu.au> writes:

> Hi again,
>
>
> On 20/09/16 16:34, Ben Woodcroft wrote:
>> Oops, forgot to cc the list.
>>
>>
>> On 20/09/16 16:02, Ben Woodcroft wrote:
>>> Hi Marius,
>>>
>>> Thanks for the patches.
>>>
>>> On 17/09/16 20:10, Marius Bakke wrote:
>>>> [..]
>>>> +         (add-after 'unpack 'fix-tests
>>>> +           (lambda _
>>>> +             ;; See https://github.com/pabigot/pyxb/issues/26 ...
>>>> +             (delete-file "tests/trac/test-trac-0091.py")
>>>
>>> The fix for that test failing seems straightforward enough, might be 
>>> better to include as a patch so those tests are run.
>>> https://github.com/pabigot/pyxb/commit/d4bdd5a1c712cd70f96264ae13b55d015cbf3335 
>>>
> Actually, 1.2.5 just got released which has both of these fixes. Can you 
> send an updated patch please?

Hi Ben,

Thanks for the review. Updated patches attached.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-python-pysam-Update-to-0.9.1.4.patch --]
[-- Type: text/x-patch, Size: 1174 bytes --]

From 0a6220a664ecf3aa967211db5bf9e9b9e539220d Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Fri, 16 Sep 2016 18:05:15 +0100
Subject: [PATCH 1/3] gnu: python-pysam: Update to 0.9.1.4.

* gnu/packages/bioinformatics.scm (python-pysam, python2-pysam): Update
to 0.9.1.4.
---
 gnu/packages/bioinformatics.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index 7a27e0b..47b884e 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -1290,13 +1290,13 @@ multiple sequence alignments.")
 (define-public python-pysam
   (package
     (name "python-pysam")
-    (version "0.8.4")
+    (version "0.9.1.4")
     (source (origin
               (method url-fetch)
               (uri (pypi-uri "pysam" version))
               (sha256
                (base32
-                "1slx5mb94mzm5qzk52q270sab0sar95j67w1g1k452nz3s9j7krh"))))
+                "1i1djacqbr88y7w18b4aa78zxnsyr4sz7yqdq2spi7gs0y6pzvjn"))))
     (build-system python-build-system)
     (arguments
      `(#:tests? #f ; tests are excluded in the manifest
-- 
2.10.0


[-- Attachment #3: 0002-gnu-Add-python-pyxb.patch --]
[-- Type: text/x-patch, Size: 1994 bytes --]

From 6a8ddd17d7f11e0687217c8649a452a1a56c596c Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Sat, 17 Sep 2016 10:33:28 +0100
Subject: [PATCH 2/3] gnu: Add python-pyxb.

* gnu/packages/xml.scm (python-pyxb, python2-pyxb): New variables.
---
 gnu/packages/xml.scm | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/gnu/packages/xml.scm b/gnu/packages/xml.scm
index 7befad5..cd3426b 100644
--- a/gnu/packages/xml.scm
+++ b/gnu/packages/xml.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is>
 ;;; Copyright © 2016 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2016 Marius Bakke <mbakke@fastmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -729,6 +730,30 @@ different Unicode encodings which happen automatically during
 parsing/saving.")
     (license license:expat)))
 
+(define-public python-pyxb
+  (package
+    (name "python-pyxb")
+    (version "1.2.5")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "PyXB" version))
+              (sha256
+               (base32
+                "0rzzwibfqa28gxgcxx4cybx1qcg0g6fand06ykj3gz7z5kp653sf"))))
+    (build-system python-build-system)
+    (home-page "http://pyxb.sourceforge.net/")
+    (synopsis "Python XML Schema Bindings")
+    (description
+     "PyXB (\"pixbee\") is a pure Python package that generates Python source
+code for classes that correspond to data structures defined by XMLSchema.")
+    (license (list license:asl2.0    ; Most files.
+                   license:expat     ; pyxb/utils/six.py
+                   license:gpl2      ; bundled jquery in doc is dual MIT/GPL2
+                   license:psfl))))  ; pyxb/utils/activestate.py
+
+(define-public python2-pyxb
+  (package-with-python2 python-pyxb))
+
 (define-public xmlto
   (package
     (name "xmlto")
-- 
2.10.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-gnu-python2-pbcore-Update-to-1.2.10.patch --]
[-- Type: text/x-patch, Size: 1690 bytes --]

From 396cbcbfda24ce5cd1caecedf01407bf6a1f70a1 Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Sat, 17 Sep 2016 10:42:56 +0100
Subject: [PATCH 3/3] gnu: python2-pbcore: Update to 1.2.10.

* gnu/packages/bioinformatics.scm (python2-pbcore): Update to 1.2.10.
[propagated-inputs]: New field. Add python2-pyxb.
---
 gnu/packages/bioinformatics.scm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index 47b884e..a598351 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -3376,13 +3376,13 @@ interrupted by stop codons.  OrfM finds and prints these ORFs.")
 (define-public python2-pbcore
   (package
     (name "python2-pbcore")
-    (version "1.2.8")
+    (version "1.2.10")
     (source (origin
               (method url-fetch)
               (uri (pypi-uri "pbcore" version))
               (sha256
                (base32
-                "02pfn5raa3zf739672bg0dkx7z3j2c4nx7vmpfjqy5b12jrqpymk"))))
+                "1kjmv891d6qbpp4shhhvkl02ff4q5xlpnls2513sm2cjcrs52f1i"))))
     (build-system python-build-system)
     (arguments `(#:python ,python-2)) ; pbcore requires Python 2.7
     (inputs
@@ -3395,6 +3395,8 @@ interrupted by stop codons.  OrfM finds and prints these ORFs.")
        ("python-nose" ,python2-nose)
        ("python-setuptools" ,python2-setuptools)
        ("python-sphinx" ,python2-sphinx)))
+    (propagated-inputs
+     `(("python-pyxb" ,python2-pyxb)))
     (home-page "http://pacificbiosciences.github.io/pbcore/")
     (synopsis "Library for reading and writing PacBio data files")
     (description
-- 
2.10.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/3] gnu: Add python-pyxb.
  2016-09-21 21:14         ` Marius Bakke
@ 2016-09-22  0:46           ` Ben Woodcroft
  2016-09-22 15:15             ` Marius Bakke
  0 siblings, 1 reply; 18+ messages in thread
From: Ben Woodcroft @ 2016-09-22  0:46 UTC (permalink / raw)
  To: Marius Bakke, guix-devel@gnu.org

On 22/09/16 07:14, Marius Bakke wrote:
> [..]
> Hi Ben,
>
> Thanks for the review. Updated patches attached.
>
Hi,

> Subject: [PATCH 1/3] gnu: python-pysam: Update to 0.9.1.4.
I'm not sure whether this is a product of the upgrade or not, but I 
notice this in the build log. I think it is harmless though, WDYT?

starting phase `validate-runpath'
validating RUNPATH of 10 binaries in 
"/gnu/store/bpiq3lm6b1kpf54i1vj2dl09ff293wic-python-pysam-0.9.1.4/lib"...
/gnu/store/bpiq3lm6b1kpf54i1vj2dl09ff293wic-python-pysam-0.9.1.4/lib/python3.4/site-packages/pysam-0.9.1.4-py3.4-linux-x86_64.egg/pysam/libchtslib.cpython-34m.so: 
warning: RUNPATH contains bogus entries: ("pysam" "." 
"build/lib.linux-x86_64-3.4/pysam")

Also, I notice that pysam bundles htslib, bcftools and samtools C code. 
Hopefully it should be straightforward enough to remove htslib as there 
are install instructions, I'm not sure about the other two. This 
shouldn't block the patch here, but would you mind taking a look?
http://pysam.readthedocs.io/en/latest/installation.html#installation

The other two patches LGTM.
ben

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/3] gnu: Add python-pyxb.
  2016-09-22  0:46           ` Ben Woodcroft
@ 2016-09-22 15:15             ` Marius Bakke
  2016-09-23  1:28               ` Ben Woodcroft
  0 siblings, 1 reply; 18+ messages in thread
From: Marius Bakke @ 2016-09-22 15:15 UTC (permalink / raw)
  To: Ben Woodcroft, guix-devel@gnu.org

[-- Attachment #1: Type: text/plain, Size: 2900 bytes --]

Ben Woodcroft <b.woodcroft@uq.edu.au> writes:

>> Subject: [PATCH 1/3] gnu: python-pysam: Update to 0.9.1.4.
> I'm not sure whether this is a product of the upgrade or not, but I 
> notice this in the build log. I think it is harmless though, WDYT?
>
> starting phase `validate-runpath'
> validating RUNPATH of 10 binaries in 
> "/gnu/store/bpiq3lm6b1kpf54i1vj2dl09ff293wic-python-pysam-0.9.1.4/lib"...
> /gnu/store/bpiq3lm6b1kpf54i1vj2dl09ff293wic-python-pysam-0.9.1.4/lib/python3.4/site-packages/pysam-0.9.1.4-py3.4-linux-x86_64.egg/pysam/libchtslib.cpython-34m.so: 
> warning: RUNPATH contains bogus entries: ("pysam" "." 
> "build/lib.linux-x86_64-3.4/pysam")

I don't see this in the previous version, so it is a regression.
However, it should be mostly harmless. Readelf reports (when compiled
with external htslib, see below):

 0x000000000000001d (RUNPATH)            Library runpath: [/gnu/store/m4gc2wx4q9if1vrhgclpspdil7rqsn21-python-3.4.3/lib:/gnu/store/ba22myqvxccwmmjwwq665rc43hanycxy-htslib-1.3.1/lib:build/lib.linux-x86_64-3.4/pysam:$ORIGIN:/gnu/store/m9vxvhdj691bq1f85lpflvnhcvrdilih-glibc-2.23/lib:/gnu/store/9nifwk709wajpyfwa0jzaa3p6mf10vxs-gcc-4.9.3-lib/lib:/gnu/store/xl19qrfzga52vrvp4ncccwjlnrjqwj95-ncurses-6.0/lib:/gnu/store/5992iq1v7arqa14ym3di58n4la0893nv-zlib-1.2.8/lib:/gnu/store/9nifwk709wajpyfwa0jzaa3p6mf10vxs-gcc-4.9.3-lib/lib/gcc/x86_64-unknown-linux-gnu/4.9.3/../../..]

Compared to the runpath of the same file currently in Guix:

 0x000000000000001d (RUNPATH)            Library runpath: [/gnu/store/m4gc2wx4q9if1vrhgclpspdil7rqsn21-python-3.4.3/lib:/gnu/store/m9vxvhdj691bq1f85lpflvnhcvrdilih-glibc-2.23/lib:/gnu/store/9nifwk709wajpyfwa0jzaa3p6mf10vxs-gcc-4.9.3-lib/lib:/gnu/store/xl19qrfzga52vrvp4ncccwjlnrjqwj95-ncurses-6.0/lib:/gnu/store/5992iq1v7arqa14ym3di58n4la0893nv-zlib-1.2.8/lib:/gnu/store/9nifwk709wajpyfwa0jzaa3p6mf10vxs-gcc-4.9.3-lib/lib/gcc/x86_64-unknown-linux-gnu/4.9.3/../../..]

If a folder named "$CWD/build/lib.linux-x86_64-3.4/pysam exists, it
could potentially allow for code injection, which is troubling.

I opened an issue on their tracker, but don't think it's worth holding
the patch: https://github.com/pysam-developers/pysam/issues/347

>
> Also, I notice that pysam bundles htslib, bcftools and samtools C code. 
> Hopefully it should be straightforward enough to remove htslib as there 
> are install instructions, I'm not sure about the other two. This 
> shouldn't block the patch here, but would you mind taking a look?
> http://pysam.readthedocs.io/en/latest/installation.html#installation

I had a go at this, and also enabled tests since I was reading the build
system anyway. Samtools and bcftools does not seem possible to un-bundle
at this time, but htslib was straightforward.

Enabling tests required packaging bcftools as well. I've attached the
full patch series below. The first three commits are unchanged.

Thanks!


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-python-pysam-Update-to-0.9.1.4.patch --]
[-- Type: text/x-patch, Size: 1174 bytes --]

From 0a6220a664ecf3aa967211db5bf9e9b9e539220d Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Fri, 16 Sep 2016 18:05:15 +0100
Subject: [PATCH 1/6] gnu: python-pysam: Update to 0.9.1.4.

* gnu/packages/bioinformatics.scm (python-pysam, python2-pysam): Update
to 0.9.1.4.
---
 gnu/packages/bioinformatics.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index 7a27e0b..47b884e 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -1290,13 +1290,13 @@ multiple sequence alignments.")
 (define-public python-pysam
   (package
     (name "python-pysam")
-    (version "0.8.4")
+    (version "0.9.1.4")
     (source (origin
               (method url-fetch)
               (uri (pypi-uri "pysam" version))
               (sha256
                (base32
-                "1slx5mb94mzm5qzk52q270sab0sar95j67w1g1k452nz3s9j7krh"))))
+                "1i1djacqbr88y7w18b4aa78zxnsyr4sz7yqdq2spi7gs0y6pzvjn"))))
     (build-system python-build-system)
     (arguments
      `(#:tests? #f ; tests are excluded in the manifest
-- 
2.10.0


[-- Attachment #3: 0002-gnu-Add-python-pyxb.patch --]
[-- Type: text/x-patch, Size: 1994 bytes --]

From 6a8ddd17d7f11e0687217c8649a452a1a56c596c Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Sat, 17 Sep 2016 10:33:28 +0100
Subject: [PATCH 2/6] gnu: Add python-pyxb.

* gnu/packages/xml.scm (python-pyxb, python2-pyxb): New variables.
---
 gnu/packages/xml.scm | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/gnu/packages/xml.scm b/gnu/packages/xml.scm
index 7befad5..cd3426b 100644
--- a/gnu/packages/xml.scm
+++ b/gnu/packages/xml.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is>
 ;;; Copyright © 2016 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2016 Marius Bakke <mbakke@fastmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -729,6 +730,30 @@ different Unicode encodings which happen automatically during
 parsing/saving.")
     (license license:expat)))
 
+(define-public python-pyxb
+  (package
+    (name "python-pyxb")
+    (version "1.2.5")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "PyXB" version))
+              (sha256
+               (base32
+                "0rzzwibfqa28gxgcxx4cybx1qcg0g6fand06ykj3gz7z5kp653sf"))))
+    (build-system python-build-system)
+    (home-page "http://pyxb.sourceforge.net/")
+    (synopsis "Python XML Schema Bindings")
+    (description
+     "PyXB (\"pixbee\") is a pure Python package that generates Python source
+code for classes that correspond to data structures defined by XMLSchema.")
+    (license (list license:asl2.0    ; Most files.
+                   license:expat     ; pyxb/utils/six.py
+                   license:gpl2      ; bundled jquery in doc is dual MIT/GPL2
+                   license:psfl))))  ; pyxb/utils/activestate.py
+
+(define-public python2-pyxb
+  (package-with-python2 python-pyxb))
+
 (define-public xmlto
   (package
     (name "xmlto")
-- 
2.10.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-gnu-python2-pbcore-Update-to-1.2.10.patch --]
[-- Type: text/x-patch, Size: 1690 bytes --]

From 396cbcbfda24ce5cd1caecedf01407bf6a1f70a1 Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Sat, 17 Sep 2016 10:42:56 +0100
Subject: [PATCH 3/6] gnu: python2-pbcore: Update to 1.2.10.

* gnu/packages/bioinformatics.scm (python2-pbcore): Update to 1.2.10.
[propagated-inputs]: New field. Add python2-pyxb.
---
 gnu/packages/bioinformatics.scm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index 47b884e..a598351 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -3376,13 +3376,13 @@ interrupted by stop codons.  OrfM finds and prints these ORFs.")
 (define-public python2-pbcore
   (package
     (name "python2-pbcore")
-    (version "1.2.8")
+    (version "1.2.10")
     (source (origin
               (method url-fetch)
               (uri (pypi-uri "pbcore" version))
               (sha256
                (base32
-                "02pfn5raa3zf739672bg0dkx7z3j2c4nx7vmpfjqy5b12jrqpymk"))))
+                "1kjmv891d6qbpp4shhhvkl02ff4q5xlpnls2513sm2cjcrs52f1i"))))
     (build-system python-build-system)
     (arguments `(#:python ,python-2)) ; pbcore requires Python 2.7
     (inputs
@@ -3395,6 +3395,8 @@ interrupted by stop codons.  OrfM finds and prints these ORFs.")
        ("python-nose" ,python2-nose)
        ("python-setuptools" ,python2-setuptools)
        ("python-sphinx" ,python2-sphinx)))
+    (propagated-inputs
+     `(("python-pyxb" ,python2-pyxb)))
     (home-page "http://pacificbiosciences.github.io/pbcore/")
     (synopsis "Library for reading and writing PacBio data files")
     (description
-- 
2.10.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: 0004-gnu-Add-bcftools.patch --]
[-- Type: text/x-patch, Size: 3295 bytes --]

From 2f61ecb17e155c41624a81d4d95d2e80823da02c Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Thu, 22 Sep 2016 13:47:53 +0100
Subject: [PATCH 4/6] gnu: Add bcftools.

* gnu/packages/bioinformatics.scm (bcftools): New variable.
---
 gnu/packages/bioinformatics.scm | 60 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index a598351..e9ab05f 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -265,6 +265,66 @@ instance, it implements several methods to assess contig-wise read coverage.")
 BAM files.")
     (license license:expat)))
 
+(define-public bcftools
+  (package
+    (name "bcftools")
+    (version "1.3.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "https://github.com/samtools/bcftools/releases/download/"
+                    version "/bcftools-" version ".tar.bz2"))
+              (sha256
+               (base32
+                "095ry68vmz9q5s1scjsa698dhgyvgw5aicz24c19iwfbai07mhqj"))
+              (modules '((guix build utils)))
+              (snippet
+               ;; Delete bundled htslib.
+               '(delete-file-recursively "htslib-1.3.1"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:test-target "test"
+       #:make-flags (list
+                     "USE_GPL=1"
+                     (string-append "prefix=" (assoc-ref %outputs "out"))
+                     (string-append
+                      "HTSDIR=" (assoc-ref %build-inputs "htslib") "/include")
+                     (string-append
+                      "HTSLIB=" (assoc-ref %build-inputs "htslib") "/lib/libhts.a")
+                     (string-append
+                      "BGZIP=" (assoc-ref %build-inputs "htslib") "/bin/bgzip")
+                     (string-append
+                      "TABIX=" (assoc-ref %build-inputs "htslib") "/bin/tabix"))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-Makefile
+           (lambda _
+             (substitute* "Makefile"
+               ;; Do not attempt to build htslib.
+               (("^include \\$\\(HTSDIR\\)/htslib\\.mk") "")
+               ;; Link against GSL cblas.
+               (("-lcblas") "-lgslcblas"))
+             #t))
+         (delete 'configure)
+         (add-before 'check 'patch-/bin/bash
+           (lambda _
+             (substitute* "test/test.pl"
+               (("/bin/bash") (which "bash"))))))))
+    (native-inputs
+     `(("htslib" ,htslib)
+       ("perl" ,perl)))
+    (inputs
+     `(("gsl" ,gsl)
+       ("zlib" ,zlib)))
+    (home-page "https://samtools.github.io/bcftools/")
+    (synopsis "Utilities for variant calling and manipulating VCFs and BCFs")
+    (description
+     "BCFtools is a set of utilities that manipulate variant calls in the
+Variant Call Format (VCF) and its binary counterpart BCF.  All commands work
+transparently with both VCFs and BCFs, both uncompressed and BGZF-compressed.")
+    ;; The sources are dual MIT/GPL, but becomes GPL-only when USE_GPL=1.
+    (license (list license:gpl3+ license:expat))))
+
 (define-public bedops
   (package
     (name "bedops")
-- 
2.10.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: 0005-gnu-python-pysam-Delete-bundled-htslib.patch --]
[-- Type: text/x-patch, Size: 2280 bytes --]

From 29d8aab712b611a6c786aa9b2c47f45e51203ca1 Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Thu, 22 Sep 2016 14:08:05 +0100
Subject: [PATCH 5/6] gnu: python-pysam: Delete bundled htslib.

* gnu/packages/bioinformatics.scm (python-pysam)[source]: Add snippet
to delete htslib.
[arguments]: Adjust to modify-phases. Add htslib flags in 'set-flags.
[propagated-inputs]: New field. Add htslib.
---
 gnu/packages/bioinformatics.scm | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index e9ab05f..edfb943 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -1356,17 +1356,27 @@ multiple sequence alignments.")
               (uri (pypi-uri "pysam" version))
               (sha256
                (base32
-                "1i1djacqbr88y7w18b4aa78zxnsyr4sz7yqdq2spi7gs0y6pzvjn"))))
+                "1i1djacqbr88y7w18b4aa78zxnsyr4sz7yqdq2spi7gs0y6pzvjn"))
+              (modules '((guix build utils)))
+              (snippet
+               ;; Drop bundled htslib. TODO: Also remove samtools and bcftools.
+               '(delete-file-recursively "htslib"))))
     (build-system python-build-system)
     (arguments
      `(#:tests? #f ; tests are excluded in the manifest
        #:phases
-       (alist-cons-before
-        'build 'set-flags
-        (lambda _
-          (setenv "LDFLAGS" "-lncurses")
-          (setenv "CFLAGS" "-D_CURSES_LIB=1"))
-        %standard-phases)))
+       (modify-phases %standard-phases
+         (add-before 'build 'set-flags
+           (lambda* (#:key inputs #:allow-other-keys)
+             (setenv "LDFLAGS" "-lncurses")
+             (setenv "HTSLIB_MODE" "external")
+             (setenv "HTSLIB_LIBRARY_DIR" (string-append
+                                           (assoc-ref inputs "htslib") "/lib"))
+             (setenv "HTSLIB_INCLUDE_DIR" (string-append
+                                           (assoc-ref inputs "htslib") "/include"))
+             (setenv "CFLAGS" "-D_CURSES_LIB=1"))))))
+    (propagated-inputs
+     `(("htslib"            ,htslib)))
     (inputs
      `(("ncurses"           ,ncurses)
        ("zlib"              ,zlib)))
-- 
2.10.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #7: 0006-gnu-python-pysam-Enable-tests.patch --]
[-- Type: text/x-patch, Size: 3624 bytes --]

From ab4f0a5174554a7f2b7b243b5488654de7d81ac1 Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Thu, 22 Sep 2016 14:11:59 +0100
Subject: [PATCH 6/6] gnu: python-pysam: Enable tests.

* gnu/packages/bioinformatics.scm (python-pysam)[source]: Change from
PyPi to source archive due to missing test data.
[arguments]: Add check phase after install.
[native-inputs]: Add python-nose, samtools and bcftools.
---
 gnu/packages/bioinformatics.scm | 33 ++++++++++++++++++++++++++++-----
 1 file changed, 28 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index edfb943..abbe601 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -1353,18 +1353,21 @@ multiple sequence alignments.")
     (version "0.9.1.4")
     (source (origin
               (method url-fetch)
-              (uri (pypi-uri "pysam" version))
+              ;; Test data is missing on PyPi.
+              (uri (string-append
+                    "https://github.com/pysam-developers/pysam/archive/v"
+                    version ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
               (sha256
                (base32
-                "1i1djacqbr88y7w18b4aa78zxnsyr4sz7yqdq2spi7gs0y6pzvjn"))
+                "0y41ssbg6nvn2jgcbnrvkzblpjcwszaiv1rgyd8dwzjkrbfsgsmc"))
               (modules '((guix build utils)))
               (snippet
                ;; Drop bundled htslib. TODO: Also remove samtools and bcftools.
                '(delete-file-recursively "htslib"))))
     (build-system python-build-system)
     (arguments
-     `(#:tests? #f ; tests are excluded in the manifest
-       #:phases
+     `(#:phases
        (modify-phases %standard-phases
          (add-before 'build 'set-flags
            (lambda* (#:key inputs #:allow-other-keys)
@@ -1374,7 +1377,24 @@ multiple sequence alignments.")
                                            (assoc-ref inputs "htslib") "/lib"))
              (setenv "HTSLIB_INCLUDE_DIR" (string-append
                                            (assoc-ref inputs "htslib") "/include"))
-             (setenv "CFLAGS" "-D_CURSES_LIB=1"))))))
+             (setenv "CFLAGS" "-D_CURSES_LIB=1")))
+         (delete 'check)
+         (add-after 'install 'check
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (setenv "PYTHONPATH"
+                     (string-append
+                      (getenv "PYTHONPATH")
+                      ":" (assoc-ref outputs "out")
+                      "/lib/python"
+                      (string-take (string-take-right
+                                    (assoc-ref inputs "python") 5) 3)
+                      "/site-packages"))
+             ;; Step out of source dir so python does not import from CWD.
+             (chdir "tests")
+             (setenv "HOME" "/tmp")
+             (and (zero? (system* "make" "-C" "pysam_data"))
+                  (zero? (system* "make" "-C" "cbcf_data"))
+                  (zero? (system* "nosetests" "-v"))))))))
     (propagated-inputs
      `(("htslib"            ,htslib)))
     (inputs
@@ -1382,6 +1402,9 @@ multiple sequence alignments.")
        ("zlib"              ,zlib)))
     (native-inputs
      `(("python-cython"     ,python-cython)
+       ("python-nose"       ,python-nose)
+       ("samtools"          ,samtools)
+       ("bcftools"          ,bcftools)
        ("python-setuptools" ,python-setuptools)))
     (home-page "https://github.com/pysam-developers/pysam")
     (synopsis "Python bindings to the SAMtools C API")
-- 
2.10.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/3] gnu: Add python-pyxb.
  2016-09-22 15:15             ` Marius Bakke
@ 2016-09-23  1:28               ` Ben Woodcroft
  2016-09-23 15:56                 ` Marius Bakke
  0 siblings, 1 reply; 18+ messages in thread
From: Ben Woodcroft @ 2016-09-23  1:28 UTC (permalink / raw)
  To: Marius Bakke, guix-devel@gnu.org



On 09/23/2016 01:15 AM, Marius Bakke wrote:
> Ben Woodcroft <b.woodcroft@uq.edu.au> writes:
>
>>> Subject: [PATCH 1/3] gnu: python-pysam: Update to 0.9.1.4.
>> I'm not sure whether this is a product of the upgrade or not, but I
>> notice this in the build log. I think it is harmless though, WDYT?
>>
>> starting phase `validate-runpath'
>> validating RUNPATH of 10 binaries in
>> "/gnu/store/bpiq3lm6b1kpf54i1vj2dl09ff293wic-python-pysam-0.9.1.4/lib"...
>> /gnu/store/bpiq3lm6b1kpf54i1vj2dl09ff293wic-python-pysam-0.9.1.4/lib/python3.4/site-packages/pysam-0.9.1.4-py3.4-linux-x86_64.egg/pysam/libchtslib.cpython-34m.so:
>> warning: RUNPATH contains bogus entries: ("pysam" "."
>> "build/lib.linux-x86_64-3.4/pysam")
> I don't see this in the previous version, so it is a regression.
> However, it should be mostly harmless. Readelf reports (when compiled
> with external htslib, see below):
>
>   0x000000000000001d (RUNPATH)            Library runpath: [/gnu/store/m4gc2wx4q9if1vrhgclpspdil7rqsn21-python-3.4.3/lib:/gnu/store/ba22myqvxccwmmjwwq665rc43hanycxy-htslib-1.3.1/lib:build/lib.linux-x86_64-3.4/pysam:$ORIGIN:/gnu/store/m9vxvhdj691bq1f85lpflvnhcvrdilih-glibc-2.23/lib:/gnu/store/9nifwk709wajpyfwa0jzaa3p6mf10vxs-gcc-4.9.3-lib/lib:/gnu/store/xl19qrfzga52vrvp4ncccwjlnrjqwj95-ncurses-6.0/lib:/gnu/store/5992iq1v7arqa14ym3di58n4la0893nv-zlib-1.2.8/lib:/gnu/store/9nifwk709wajpyfwa0jzaa3p6mf10vxs-gcc-4.9.3-lib/lib/gcc/x86_64-unknown-linux-gnu/4.9.3/../../..]
>
> Compared to the runpath of the same file currently in Guix:
>
>   0x000000000000001d (RUNPATH)            Library runpath: [/gnu/store/m4gc2wx4q9if1vrhgclpspdil7rqsn21-python-3.4.3/lib:/gnu/store/m9vxvhdj691bq1f85lpflvnhcvrdilih-glibc-2.23/lib:/gnu/store/9nifwk709wajpyfwa0jzaa3p6mf10vxs-gcc-4.9.3-lib/lib:/gnu/store/xl19qrfzga52vrvp4ncccwjlnrjqwj95-ncurses-6.0/lib:/gnu/store/5992iq1v7arqa14ym3di58n4la0893nv-zlib-1.2.8/lib:/gnu/store/9nifwk709wajpyfwa0jzaa3p6mf10vxs-gcc-4.9.3-lib/lib/gcc/x86_64-unknown-linux-gnu/4.9.3/../../..]
>
> If a folder named "$CWD/build/lib.linux-x86_64-3.4/pysam exists, it
> could potentially allow for code injection, which is troubling.
>
> I opened an issue on their tracker, but don't think it's worth holding
> the patch: https://github.com/pysam-developers/pysam/issues/347
Thanks, I agree.

>
>> Also, I notice that pysam bundles htslib, bcftools and samtools C code.
>> Hopefully it should be straightforward enough to remove htslib as there
>> are install instructions, I'm not sure about the other two. This
>> shouldn't block the patch here, but would you mind taking a look?
>> http://pysam.readthedocs.io/en/latest/installation.html#installation
> I had a go at this, and also enabled tests since I was reading the build
> system anyway. Samtools and bcftools does not seem possible to un-bundle
> at this time, but htslib was straightforward.
OK. I don't think it needs to be propagated though, right? Also, would 
you mind separating the change to modify-phases syntax and unbundling of 
htslib into two patches please? Other than that this whole series LGTM.

Sorry, I keep asking one more thing..
ben

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/3] gnu: Add python-pyxb.
  2016-09-23  1:28               ` Ben Woodcroft
@ 2016-09-23 15:56                 ` Marius Bakke
  2016-09-23 16:06                   ` Marius Bakke
  2016-09-24  0:23                   ` Ben Woodcroft
  0 siblings, 2 replies; 18+ messages in thread
From: Marius Bakke @ 2016-09-23 15:56 UTC (permalink / raw)
  To: Ben Woodcroft, guix-devel@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1134 bytes --]

Ben Woodcroft <b.woodcroft@uq.edu.au> writes:

>>
>>> Also, I notice that pysam bundles htslib, bcftools and samtools C code.
>>> Hopefully it should be straightforward enough to remove htslib as there
>>> are install instructions, I'm not sure about the other two. This
>>> shouldn't block the patch here, but would you mind taking a look?
>>> http://pysam.readthedocs.io/en/latest/installation.html#installation
>> I had a go at this, and also enabled tests since I was reading the build
>> system anyway. Samtools and bcftools does not seem possible to un-bundle
>> at this time, but htslib was straightforward.
> OK. I don't think it needs to be propagated though, right? Also, would 
> you mind separating the change to modify-phases syntax and unbundling of 
> htslib into two patches please? Other than that this whole series LGTM.

Modify-phases is now a separate patch. Htslib is propagated because it
is included by the installed samtools and bcftools headers; at least one
of pysams dependencies failed to build when it was a regular input.

I added some comments and other cosmetic changes. Updated patch below.

Cheers!


[-- Attachment #2: pysam-and-pbcore-update.patch --]
[-- Type: text/x-patch, Size: 15357 bytes --]

From eaa38fb4174997f6282ff7d278a6aa4153b75bcf Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Fri, 16 Sep 2016 18:05:15 +0100
Subject: [PATCH 1/7] gnu: python-pysam: Update to 0.9.1.4.

* gnu/packages/bioinformatics.scm (python-pysam, python2-pysam): Update
to 0.9.1.4.
---
 gnu/packages/bioinformatics.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index 1bf91a9..6e83461 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -1290,13 +1290,13 @@ multiple sequence alignments.")
 (define-public python-pysam
   (package
     (name "python-pysam")
-    (version "0.8.4")
+    (version "0.9.1.4")
     (source (origin
               (method url-fetch)
               (uri (pypi-uri "pysam" version))
               (sha256
                (base32
-                "1slx5mb94mzm5qzk52q270sab0sar95j67w1g1k452nz3s9j7krh"))))
+                "1i1djacqbr88y7w18b4aa78zxnsyr4sz7yqdq2spi7gs0y6pzvjn"))))
     (build-system python-build-system)
     (arguments
      `(#:tests? #f ; tests are excluded in the manifest
-- 
2.10.0


From 5431b05fe66398f5c44a1f0a81e1e90663550ac1 Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Sat, 17 Sep 2016 10:33:28 +0100
Subject: [PATCH 2/7] gnu: Add python-pyxb.

* gnu/packages/xml.scm (python-pyxb, python2-pyxb): New variables.
---
 gnu/packages/xml.scm | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/gnu/packages/xml.scm b/gnu/packages/xml.scm
index 7befad5..cd3426b 100644
--- a/gnu/packages/xml.scm
+++ b/gnu/packages/xml.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is>
 ;;; Copyright © 2016 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2016 Marius Bakke <mbakke@fastmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -729,6 +730,30 @@ different Unicode encodings which happen automatically during
 parsing/saving.")
     (license license:expat)))
 
+(define-public python-pyxb
+  (package
+    (name "python-pyxb")
+    (version "1.2.5")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "PyXB" version))
+              (sha256
+               (base32
+                "0rzzwibfqa28gxgcxx4cybx1qcg0g6fand06ykj3gz7z5kp653sf"))))
+    (build-system python-build-system)
+    (home-page "http://pyxb.sourceforge.net/")
+    (synopsis "Python XML Schema Bindings")
+    (description
+     "PyXB (\"pixbee\") is a pure Python package that generates Python source
+code for classes that correspond to data structures defined by XMLSchema.")
+    (license (list license:asl2.0    ; Most files.
+                   license:expat     ; pyxb/utils/six.py
+                   license:gpl2      ; bundled jquery in doc is dual MIT/GPL2
+                   license:psfl))))  ; pyxb/utils/activestate.py
+
+(define-public python2-pyxb
+  (package-with-python2 python-pyxb))
+
 (define-public xmlto
   (package
     (name "xmlto")
-- 
2.10.0


From 923fc43d8c665d1a2795ea2c221003e54544a06b Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Sat, 17 Sep 2016 10:42:56 +0100
Subject: [PATCH 3/7] gnu: python2-pbcore: Update to 1.2.10.

* gnu/packages/bioinformatics.scm (python2-pbcore): Update to 1.2.10.
[propagated-inputs]: New field. Add python2-pyxb.
---
 gnu/packages/bioinformatics.scm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index 6e83461..a935d5a 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -3376,13 +3376,13 @@ interrupted by stop codons.  OrfM finds and prints these ORFs.")
 (define-public python2-pbcore
   (package
     (name "python2-pbcore")
-    (version "1.2.8")
+    (version "1.2.10")
     (source (origin
               (method url-fetch)
               (uri (pypi-uri "pbcore" version))
               (sha256
                (base32
-                "02pfn5raa3zf739672bg0dkx7z3j2c4nx7vmpfjqy5b12jrqpymk"))))
+                "1kjmv891d6qbpp4shhhvkl02ff4q5xlpnls2513sm2cjcrs52f1i"))))
     (build-system python-build-system)
     (arguments `(#:python ,python-2)) ; pbcore requires Python 2.7
     (inputs
@@ -3395,6 +3395,8 @@ interrupted by stop codons.  OrfM finds and prints these ORFs.")
        ("python-nose" ,python2-nose)
        ("python-setuptools" ,python2-setuptools)
        ("python-sphinx" ,python2-sphinx)))
+    (propagated-inputs
+     `(("python-pyxb" ,python2-pyxb)))
     (home-page "http://pacificbiosciences.github.io/pbcore/")
     (synopsis "Library for reading and writing PacBio data files")
     (description
-- 
2.10.0


From 7748677c13242b7edb6ddae1efed7f0699e487bf Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Thu, 22 Sep 2016 13:47:53 +0100
Subject: [PATCH 4/7] gnu: Add bcftools.

* gnu/packages/bioinformatics.scm (bcftools): New variable.
---
 gnu/packages/bioinformatics.scm | 58 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index a935d5a..679502e 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -265,6 +265,64 @@ instance, it implements several methods to assess contig-wise read coverage.")
 BAM files.")
     (license license:expat)))
 
+(define-public bcftools
+  (package
+    (name "bcftools")
+    (version "1.3.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "https://github.com/samtools/bcftools/releases/download/"
+                    version "/bcftools-" version ".tar.bz2"))
+              (sha256
+               (base32
+                "095ry68vmz9q5s1scjsa698dhgyvgw5aicz24c19iwfbai07mhqj"))
+              (modules '((guix build utils)))
+              (snippet
+               ;; Delete bundled htslib.
+               '(delete-file-recursively "htslib-1.3.1"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:test-target "test"
+       #:make-flags
+       (list
+        "USE_GPL=1"
+        (string-append "prefix=" (assoc-ref %outputs "out"))
+        (string-append "HTSDIR=" (assoc-ref %build-inputs "htslib") "/include")
+        (string-append "HTSLIB=" (assoc-ref %build-inputs "htslib") "/lib/libhts.a")
+        (string-append "BGZIP=" (assoc-ref %build-inputs "htslib") "/bin/bgzip")
+        (string-append "TABIX=" (assoc-ref %build-inputs "htslib") "/bin/tabix"))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-Makefile
+           (lambda _
+             (substitute* "Makefile"
+               ;; Do not attempt to build htslib.
+               (("^include \\$\\(HTSDIR\\)/htslib\\.mk") "")
+               ;; Link against GSL cblas.
+               (("-lcblas") "-lgslcblas"))
+             #t))
+         (delete 'configure)
+         (add-before 'check 'patch-tests
+           (lambda _
+             (substitute* "test/test.pl"
+               (("/bin/bash") (which "bash")))
+             #t)))))
+    (native-inputs
+     `(("htslib" ,htslib)
+       ("perl" ,perl)))
+    (inputs
+     `(("gsl" ,gsl)
+       ("zlib" ,zlib)))
+    (home-page "https://samtools.github.io/bcftools/")
+    (synopsis "Utilities for variant calling and manipulating VCFs and BCFs")
+    (description
+     "BCFtools is a set of utilities that manipulate variant calls in the
+Variant Call Format (VCF) and its binary counterpart BCF.  All commands work
+transparently with both VCFs and BCFs, both uncompressed and BGZF-compressed.")
+    ;; The sources are dual MIT/GPL, but becomes GPL-only when USE_GPL=1.
+    (license (list license:gpl3+ license:expat))))
+
 (define-public bedops
   (package
     (name "bedops")
-- 
2.10.0


From d4fd6f8482a76ccfe4d33f80070445d284006166 Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Fri, 23 Sep 2016 06:40:40 +0100
Subject: [PATCH 5/7] gnu: python-pysam: Use 'modify-phases'.

* gnu/packages/bioinformatics.scm (python-pysam)[arguments]: Use
'modify-phases'.
---
 gnu/packages/bioinformatics.scm | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index 679502e..518dfea 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -1359,12 +1359,12 @@ multiple sequence alignments.")
     (arguments
      `(#:tests? #f ; tests are excluded in the manifest
        #:phases
-       (alist-cons-before
-        'build 'set-flags
-        (lambda _
-          (setenv "LDFLAGS" "-lncurses")
-          (setenv "CFLAGS" "-D_CURSES_LIB=1"))
-        %standard-phases)))
+       (modify-phases %standard-phases
+         (add-before 'build 'set-flags
+           (lambda _
+             (setenv "LDFLAGS" "-lncurses")
+             (setenv "CFLAGS" "-D_CURSES_LIB=1")
+             #t)))))
     (inputs
      `(("ncurses"           ,ncurses)
        ("zlib"              ,zlib)))
-- 
2.10.0


From e4d3befdc33a77f6b3d1d241befd7077c0be7e70 Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Thu, 22 Sep 2016 14:08:05 +0100
Subject: [PATCH 6/7] gnu: python-pysam: Delete bundled htslib.

* gnu/packages/bioinformatics.scm (python-pysam)[source]: Add snippet
to delete htslib.
[arguments]: Add htslib flags in 'set-flags phase.
[propagated-inputs]: New field. Add htslib.
---
 gnu/packages/bioinformatics.scm | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index 518dfea..a712a01 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -1354,17 +1354,28 @@ multiple sequence alignments.")
               (uri (pypi-uri "pysam" version))
               (sha256
                (base32
-                "1i1djacqbr88y7w18b4aa78zxnsyr4sz7yqdq2spi7gs0y6pzvjn"))))
+                "1i1djacqbr88y7w18b4aa78zxnsyr4sz7yqdq2spi7gs0y6pzvjn"))
+              (modules '((guix build utils)))
+              (snippet
+               ;; Drop bundled htslib. TODO: Also remove samtools and bcftools.
+               '(delete-file-recursively "htslib"))))
     (build-system python-build-system)
     (arguments
      `(#:tests? #f ; tests are excluded in the manifest
        #:phases
        (modify-phases %standard-phases
          (add-before 'build 'set-flags
-           (lambda _
+           (lambda* (#:key inputs #:allow-other-keys)
+             (setenv "HTSLIB_MODE" "external")
+             (setenv "HTSLIB_LIBRARY_DIR"
+                     (string-append (assoc-ref inputs "htslib") "/lib"))
+             (setenv "HTSLIB_INCLUDE_DIR"
+                     (string-append (assoc-ref inputs "htslib") "/include"))
              (setenv "LDFLAGS" "-lncurses")
              (setenv "CFLAGS" "-D_CURSES_LIB=1")
              #t)))))
+    (propagated-inputs
+     `(("htslib"            ,htslib))) ; Included from installed header files.
     (inputs
      `(("ncurses"           ,ncurses)
        ("zlib"              ,zlib)))
-- 
2.10.0


From 2afa68286db8cf55cc9dc325bef2f529b7e8f2ba Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Thu, 22 Sep 2016 14:11:59 +0100
Subject: [PATCH 7/7] gnu: python-pysam: Enable tests.

* gnu/packages/bioinformatics.scm (python-pysam)[source]: Change from
PyPi to source archive due to missing test data.
[arguments]: Add check phase after install.
[native-inputs]: Add python-nose, samtools and bcftools.
---
 gnu/packages/bioinformatics.scm | 36 ++++++++++++++++++++++++++++++------
 1 file changed, 30 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index a712a01..7a784c8 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -1351,18 +1351,21 @@ multiple sequence alignments.")
     (version "0.9.1.4")
     (source (origin
               (method url-fetch)
-              (uri (pypi-uri "pysam" version))
+              ;; Test data is missing on PyPi.
+              (uri (string-append
+                    "https://github.com/pysam-developers/pysam/archive/v"
+                    version ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
               (sha256
                (base32
-                "1i1djacqbr88y7w18b4aa78zxnsyr4sz7yqdq2spi7gs0y6pzvjn"))
+                "0y41ssbg6nvn2jgcbnrvkzblpjcwszaiv1rgyd8dwzjkrbfsgsmc"))
               (modules '((guix build utils)))
               (snippet
                ;; Drop bundled htslib. TODO: Also remove samtools and bcftools.
                '(delete-file-recursively "htslib"))))
     (build-system python-build-system)
     (arguments
-     `(#:tests? #f ; tests are excluded in the manifest
-       #:phases
+     `(#:phases
        (modify-phases %standard-phases
          (add-before 'build 'set-flags
            (lambda* (#:key inputs #:allow-other-keys)
@@ -1373,7 +1376,24 @@ multiple sequence alignments.")
                      (string-append (assoc-ref inputs "htslib") "/include"))
              (setenv "LDFLAGS" "-lncurses")
              (setenv "CFLAGS" "-D_CURSES_LIB=1")
-             #t)))))
+             #t))
+         (delete 'check)
+         (add-after 'install 'check
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (setenv "PYTHONPATH"
+                     (string-append
+                      (getenv "PYTHONPATH")
+                      ":" (assoc-ref outputs "out")
+                      "/lib/python"
+                      (string-take (string-take-right
+                                    (assoc-ref inputs "python") 5) 3)
+                      "/site-packages"))
+             ;; Step out of source dir so python does not import from CWD.
+             (chdir "tests")
+             (setenv "HOME" "/tmp")
+             (and (zero? (system* "make" "-C" "pysam_data"))
+                  (zero? (system* "make" "-C" "cbcf_data"))
+                  (zero? (system* "nosetests" "-v"))))))))
     (propagated-inputs
      `(("htslib"            ,htslib))) ; Included from installed header files.
     (inputs
@@ -1381,7 +1401,11 @@ multiple sequence alignments.")
        ("zlib"              ,zlib)))
     (native-inputs
      `(("python-cython"     ,python-cython)
-       ("python-setuptools" ,python-setuptools)))
+       ("python-setuptools" ,python-setuptools)
+       ;; Depencies below are are for tests only.
+       ("samtools"          ,samtools)
+       ("bcftools"          ,bcftools)
+       ("python-nose"       ,python-nose)))
     (home-page "https://github.com/pysam-developers/pysam")
     (synopsis "Python bindings to the SAMtools C API")
     (description
-- 
2.10.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/3] gnu: Add python-pyxb.
  2016-09-23 15:56                 ` Marius Bakke
@ 2016-09-23 16:06                   ` Marius Bakke
  2016-09-24  0:23                   ` Ben Woodcroft
  1 sibling, 0 replies; 18+ messages in thread
From: Marius Bakke @ 2016-09-23 16:06 UTC (permalink / raw)
  To: Ben Woodcroft, guix-devel@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1254 bytes --]

Marius Bakke <mbakke@fastmail.com> writes:

> Ben Woodcroft <b.woodcroft@uq.edu.au> writes:
>
>>>
>>>> Also, I notice that pysam bundles htslib, bcftools and samtools C code.
>>>> Hopefully it should be straightforward enough to remove htslib as there
>>>> are install instructions, I'm not sure about the other two. This
>>>> shouldn't block the patch here, but would you mind taking a look?
>>>> http://pysam.readthedocs.io/en/latest/installation.html#installation
>>> I had a go at this, and also enabled tests since I was reading the build
>>> system anyway. Samtools and bcftools does not seem possible to un-bundle
>>> at this time, but htslib was straightforward.
>> OK. I don't think it needs to be propagated though, right? Also, would 
>> you mind separating the change to modify-phases syntax and unbundling of 
>> htslib into two patches please? Other than that this whole series LGTM.
>
> Modify-phases is now a separate patch. Htslib is propagated because it
> is included by the installed samtools and bcftools headers; at least one
> of pysams dependencies failed to build when it was a regular input.
>
> I added some comments and other cosmetic changes. Updated patch below.

Oops, found a spelling error in the previous patch. Fixed.


[-- Attachment #2: pysam-and-pbcore-update.patch --]
[-- Type: text/x-patch, Size: 15360 bytes --]

From eaa38fb4174997f6282ff7d278a6aa4153b75bcf Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Fri, 16 Sep 2016 18:05:15 +0100
Subject: [PATCH 1/7] gnu: python-pysam: Update to 0.9.1.4.

* gnu/packages/bioinformatics.scm (python-pysam, python2-pysam): Update
to 0.9.1.4.
---
 gnu/packages/bioinformatics.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index 1bf91a9..6e83461 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -1290,13 +1290,13 @@ multiple sequence alignments.")
 (define-public python-pysam
   (package
     (name "python-pysam")
-    (version "0.8.4")
+    (version "0.9.1.4")
     (source (origin
               (method url-fetch)
               (uri (pypi-uri "pysam" version))
               (sha256
                (base32
-                "1slx5mb94mzm5qzk52q270sab0sar95j67w1g1k452nz3s9j7krh"))))
+                "1i1djacqbr88y7w18b4aa78zxnsyr4sz7yqdq2spi7gs0y6pzvjn"))))
     (build-system python-build-system)
     (arguments
      `(#:tests? #f ; tests are excluded in the manifest
-- 
2.10.0


From 5431b05fe66398f5c44a1f0a81e1e90663550ac1 Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Sat, 17 Sep 2016 10:33:28 +0100
Subject: [PATCH 2/7] gnu: Add python-pyxb.

* gnu/packages/xml.scm (python-pyxb, python2-pyxb): New variables.
---
 gnu/packages/xml.scm | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/gnu/packages/xml.scm b/gnu/packages/xml.scm
index 7befad5..cd3426b 100644
--- a/gnu/packages/xml.scm
+++ b/gnu/packages/xml.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is>
 ;;; Copyright © 2016 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2016 Marius Bakke <mbakke@fastmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -729,6 +730,30 @@ different Unicode encodings which happen automatically during
 parsing/saving.")
     (license license:expat)))
 
+(define-public python-pyxb
+  (package
+    (name "python-pyxb")
+    (version "1.2.5")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "PyXB" version))
+              (sha256
+               (base32
+                "0rzzwibfqa28gxgcxx4cybx1qcg0g6fand06ykj3gz7z5kp653sf"))))
+    (build-system python-build-system)
+    (home-page "http://pyxb.sourceforge.net/")
+    (synopsis "Python XML Schema Bindings")
+    (description
+     "PyXB (\"pixbee\") is a pure Python package that generates Python source
+code for classes that correspond to data structures defined by XMLSchema.")
+    (license (list license:asl2.0    ; Most files.
+                   license:expat     ; pyxb/utils/six.py
+                   license:gpl2      ; bundled jquery in doc is dual MIT/GPL2
+                   license:psfl))))  ; pyxb/utils/activestate.py
+
+(define-public python2-pyxb
+  (package-with-python2 python-pyxb))
+
 (define-public xmlto
   (package
     (name "xmlto")
-- 
2.10.0


From 923fc43d8c665d1a2795ea2c221003e54544a06b Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Sat, 17 Sep 2016 10:42:56 +0100
Subject: [PATCH 3/7] gnu: python2-pbcore: Update to 1.2.10.

* gnu/packages/bioinformatics.scm (python2-pbcore): Update to 1.2.10.
[propagated-inputs]: New field. Add python2-pyxb.
---
 gnu/packages/bioinformatics.scm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index 6e83461..a935d5a 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -3376,13 +3376,13 @@ interrupted by stop codons.  OrfM finds and prints these ORFs.")
 (define-public python2-pbcore
   (package
     (name "python2-pbcore")
-    (version "1.2.8")
+    (version "1.2.10")
     (source (origin
               (method url-fetch)
               (uri (pypi-uri "pbcore" version))
               (sha256
                (base32
-                "02pfn5raa3zf739672bg0dkx7z3j2c4nx7vmpfjqy5b12jrqpymk"))))
+                "1kjmv891d6qbpp4shhhvkl02ff4q5xlpnls2513sm2cjcrs52f1i"))))
     (build-system python-build-system)
     (arguments `(#:python ,python-2)) ; pbcore requires Python 2.7
     (inputs
@@ -3395,6 +3395,8 @@ interrupted by stop codons.  OrfM finds and prints these ORFs.")
        ("python-nose" ,python2-nose)
        ("python-setuptools" ,python2-setuptools)
        ("python-sphinx" ,python2-sphinx)))
+    (propagated-inputs
+     `(("python-pyxb" ,python2-pyxb)))
     (home-page "http://pacificbiosciences.github.io/pbcore/")
     (synopsis "Library for reading and writing PacBio data files")
     (description
-- 
2.10.0


From 7748677c13242b7edb6ddae1efed7f0699e487bf Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Thu, 22 Sep 2016 13:47:53 +0100
Subject: [PATCH 4/7] gnu: Add bcftools.

* gnu/packages/bioinformatics.scm (bcftools): New variable.
---
 gnu/packages/bioinformatics.scm | 58 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index a935d5a..679502e 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -265,6 +265,64 @@ instance, it implements several methods to assess contig-wise read coverage.")
 BAM files.")
     (license license:expat)))
 
+(define-public bcftools
+  (package
+    (name "bcftools")
+    (version "1.3.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "https://github.com/samtools/bcftools/releases/download/"
+                    version "/bcftools-" version ".tar.bz2"))
+              (sha256
+               (base32
+                "095ry68vmz9q5s1scjsa698dhgyvgw5aicz24c19iwfbai07mhqj"))
+              (modules '((guix build utils)))
+              (snippet
+               ;; Delete bundled htslib.
+               '(delete-file-recursively "htslib-1.3.1"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:test-target "test"
+       #:make-flags
+       (list
+        "USE_GPL=1"
+        (string-append "prefix=" (assoc-ref %outputs "out"))
+        (string-append "HTSDIR=" (assoc-ref %build-inputs "htslib") "/include")
+        (string-append "HTSLIB=" (assoc-ref %build-inputs "htslib") "/lib/libhts.a")
+        (string-append "BGZIP=" (assoc-ref %build-inputs "htslib") "/bin/bgzip")
+        (string-append "TABIX=" (assoc-ref %build-inputs "htslib") "/bin/tabix"))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-Makefile
+           (lambda _
+             (substitute* "Makefile"
+               ;; Do not attempt to build htslib.
+               (("^include \\$\\(HTSDIR\\)/htslib\\.mk") "")
+               ;; Link against GSL cblas.
+               (("-lcblas") "-lgslcblas"))
+             #t))
+         (delete 'configure)
+         (add-before 'check 'patch-tests
+           (lambda _
+             (substitute* "test/test.pl"
+               (("/bin/bash") (which "bash")))
+             #t)))))
+    (native-inputs
+     `(("htslib" ,htslib)
+       ("perl" ,perl)))
+    (inputs
+     `(("gsl" ,gsl)
+       ("zlib" ,zlib)))
+    (home-page "https://samtools.github.io/bcftools/")
+    (synopsis "Utilities for variant calling and manipulating VCFs and BCFs")
+    (description
+     "BCFtools is a set of utilities that manipulate variant calls in the
+Variant Call Format (VCF) and its binary counterpart BCF.  All commands work
+transparently with both VCFs and BCFs, both uncompressed and BGZF-compressed.")
+    ;; The sources are dual MIT/GPL, but becomes GPL-only when USE_GPL=1.
+    (license (list license:gpl3+ license:expat))))
+
 (define-public bedops
   (package
     (name "bedops")
-- 
2.10.0


From d4fd6f8482a76ccfe4d33f80070445d284006166 Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Fri, 23 Sep 2016 06:40:40 +0100
Subject: [PATCH 5/7] gnu: python-pysam: Use 'modify-phases'.

* gnu/packages/bioinformatics.scm (python-pysam)[arguments]: Use
'modify-phases'.
---
 gnu/packages/bioinformatics.scm | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index 679502e..518dfea 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -1359,12 +1359,12 @@ multiple sequence alignments.")
     (arguments
      `(#:tests? #f ; tests are excluded in the manifest
        #:phases
-       (alist-cons-before
-        'build 'set-flags
-        (lambda _
-          (setenv "LDFLAGS" "-lncurses")
-          (setenv "CFLAGS" "-D_CURSES_LIB=1"))
-        %standard-phases)))
+       (modify-phases %standard-phases
+         (add-before 'build 'set-flags
+           (lambda _
+             (setenv "LDFLAGS" "-lncurses")
+             (setenv "CFLAGS" "-D_CURSES_LIB=1")
+             #t)))))
     (inputs
      `(("ncurses"           ,ncurses)
        ("zlib"              ,zlib)))
-- 
2.10.0


From e4d3befdc33a77f6b3d1d241befd7077c0be7e70 Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Thu, 22 Sep 2016 14:08:05 +0100
Subject: [PATCH 6/7] gnu: python-pysam: Delete bundled htslib.

* gnu/packages/bioinformatics.scm (python-pysam)[source]: Add snippet
to delete htslib.
[arguments]: Add htslib flags in 'set-flags phase.
[propagated-inputs]: New field. Add htslib.
---
 gnu/packages/bioinformatics.scm | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index 518dfea..a712a01 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -1354,17 +1354,28 @@ multiple sequence alignments.")
               (uri (pypi-uri "pysam" version))
               (sha256
                (base32
-                "1i1djacqbr88y7w18b4aa78zxnsyr4sz7yqdq2spi7gs0y6pzvjn"))))
+                "1i1djacqbr88y7w18b4aa78zxnsyr4sz7yqdq2spi7gs0y6pzvjn"))
+              (modules '((guix build utils)))
+              (snippet
+               ;; Drop bundled htslib. TODO: Also remove samtools and bcftools.
+               '(delete-file-recursively "htslib"))))
     (build-system python-build-system)
     (arguments
      `(#:tests? #f ; tests are excluded in the manifest
        #:phases
        (modify-phases %standard-phases
          (add-before 'build 'set-flags
-           (lambda _
+           (lambda* (#:key inputs #:allow-other-keys)
+             (setenv "HTSLIB_MODE" "external")
+             (setenv "HTSLIB_LIBRARY_DIR"
+                     (string-append (assoc-ref inputs "htslib") "/lib"))
+             (setenv "HTSLIB_INCLUDE_DIR"
+                     (string-append (assoc-ref inputs "htslib") "/include"))
              (setenv "LDFLAGS" "-lncurses")
              (setenv "CFLAGS" "-D_CURSES_LIB=1")
              #t)))))
+    (propagated-inputs
+     `(("htslib"            ,htslib))) ; Included from installed header files.
     (inputs
      `(("ncurses"           ,ncurses)
        ("zlib"              ,zlib)))
-- 
2.10.0


From 91051e1ee8a2dfd6c4df2f3ed3c509a558f99fe2 Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Thu, 22 Sep 2016 14:11:59 +0100
Subject: [PATCH 7/7] gnu: python-pysam: Enable tests.

* gnu/packages/bioinformatics.scm (python-pysam)[source]: Change from
PyPi to source archive due to missing test data.
[arguments]: Add check phase after install.
[native-inputs]: Add python-nose, samtools and bcftools.
---
 gnu/packages/bioinformatics.scm | 36 ++++++++++++++++++++++++++++++------
 1 file changed, 30 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index a712a01..f197ce8 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -1351,18 +1351,21 @@ multiple sequence alignments.")
     (version "0.9.1.4")
     (source (origin
               (method url-fetch)
-              (uri (pypi-uri "pysam" version))
+              ;; Test data is missing on PyPi.
+              (uri (string-append
+                    "https://github.com/pysam-developers/pysam/archive/v"
+                    version ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
               (sha256
                (base32
-                "1i1djacqbr88y7w18b4aa78zxnsyr4sz7yqdq2spi7gs0y6pzvjn"))
+                "0y41ssbg6nvn2jgcbnrvkzblpjcwszaiv1rgyd8dwzjkrbfsgsmc"))
               (modules '((guix build utils)))
               (snippet
                ;; Drop bundled htslib. TODO: Also remove samtools and bcftools.
                '(delete-file-recursively "htslib"))))
     (build-system python-build-system)
     (arguments
-     `(#:tests? #f ; tests are excluded in the manifest
-       #:phases
+     `(#:phases
        (modify-phases %standard-phases
          (add-before 'build 'set-flags
            (lambda* (#:key inputs #:allow-other-keys)
@@ -1373,7 +1376,24 @@ multiple sequence alignments.")
                      (string-append (assoc-ref inputs "htslib") "/include"))
              (setenv "LDFLAGS" "-lncurses")
              (setenv "CFLAGS" "-D_CURSES_LIB=1")
-             #t)))))
+             #t))
+         (delete 'check)
+         (add-after 'install 'check
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (setenv "PYTHONPATH"
+                     (string-append
+                      (getenv "PYTHONPATH")
+                      ":" (assoc-ref outputs "out")
+                      "/lib/python"
+                      (string-take (string-take-right
+                                    (assoc-ref inputs "python") 5) 3)
+                      "/site-packages"))
+             ;; Step out of source dir so python does not import from CWD.
+             (chdir "tests")
+             (setenv "HOME" "/tmp")
+             (and (zero? (system* "make" "-C" "pysam_data"))
+                  (zero? (system* "make" "-C" "cbcf_data"))
+                  (zero? (system* "nosetests" "-v"))))))))
     (propagated-inputs
      `(("htslib"            ,htslib))) ; Included from installed header files.
     (inputs
@@ -1381,7 +1401,11 @@ multiple sequence alignments.")
        ("zlib"              ,zlib)))
     (native-inputs
      `(("python-cython"     ,python-cython)
-       ("python-setuptools" ,python-setuptools)))
+       ("python-setuptools" ,python-setuptools)
+       ;; Dependencies below are are for tests only.
+       ("samtools"          ,samtools)
+       ("bcftools"          ,bcftools)
+       ("python-nose"       ,python-nose)))
     (home-page "https://github.com/pysam-developers/pysam")
     (synopsis "Python bindings to the SAMtools C API")
     (description
-- 
2.10.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/3] gnu: Add python-pyxb.
  2016-09-23 15:56                 ` Marius Bakke
  2016-09-23 16:06                   ` Marius Bakke
@ 2016-09-24  0:23                   ` Ben Woodcroft
  2016-09-24  3:15                     ` Marius Bakke
  1 sibling, 1 reply; 18+ messages in thread
From: Ben Woodcroft @ 2016-09-24  0:23 UTC (permalink / raw)
  To: Marius Bakke, guix-devel@gnu.org



On 24/09/16 01:56, Marius Bakke wrote:
> Ben Woodcroft <b.woodcroft@uq.edu.au> writes:
>
>>>> Also, I notice that pysam bundles htslib, bcftools and samtools C code.
>>>> Hopefully it should be straightforward enough to remove htslib as there
>>>> are install instructions, I'm not sure about the other two. This
>>>> shouldn't block the patch here, but would you mind taking a look?
>>>> http://pysam.readthedocs.io/en/latest/installation.html#installation
>>> I had a go at this, and also enabled tests since I was reading the build
>>> system anyway. Samtools and bcftools does not seem possible to un-bundle
>>> at this time, but htslib was straightforward.
>> OK. I don't think it needs to be propagated though, right? Also, would
>> you mind separating the change to modify-phases syntax and unbundling of
>> htslib into two patches please? Other than that this whole series LGTM.
> Modify-phases is now a separate patch.
Thanks.

> Htslib is propagated because it
> is included by the installed samtools and bcftools headers; at least one
> of pysams dependencies failed to build when it was a regular input.
Ah, I see. Can this be avoided with patchelf?
ben

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/3] gnu: Add python-pyxb.
  2016-09-24  0:23                   ` Ben Woodcroft
@ 2016-09-24  3:15                     ` Marius Bakke
  2016-09-26 11:15                       ` Ben Woodcroft
  0 siblings, 1 reply; 18+ messages in thread
From: Marius Bakke @ 2016-09-24  3:15 UTC (permalink / raw)
  To: Ben Woodcroft, guix-devel@gnu.org

Ben Woodcroft <b.woodcroft@uq.edu.au> writes:

>> Htslib is propagated because it
>> is included by the installed samtools and bcftools headers; at least one
>> of pysams dependencies failed to build when it was a regular input.
> Ah, I see. Can this be avoided with patchelf?

I don't think so. The htslib headers need to be propagated for anything
that uses header files from pysam, since they contain contain code such
as "include <htslib/foo.h>". Perhaps you can update the comment to make
it more clear?

Patchelf is probably what made that work when htslib was bundled.

Cheers,
Marius

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/3] gnu: Add python-pyxb.
  2016-09-24  3:15                     ` Marius Bakke
@ 2016-09-26 11:15                       ` Ben Woodcroft
  2016-09-26 18:32                         ` Marius Bakke
  0 siblings, 1 reply; 18+ messages in thread
From: Ben Woodcroft @ 2016-09-26 11:15 UTC (permalink / raw)
  To: Marius Bakke, guix-devel@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1031 bytes --]



On 24/09/16 13:15, Marius Bakke wrote:
> Ben Woodcroft <b.woodcroft@uq.edu.au> writes:
>
>>> Htslib is propagated because it
>>> is included by the installed samtools and bcftools headers; at least one
>>> of pysams dependencies failed to build when it was a regular input.
>> Ah, I see. Can this be avoided with patchelf?
> I don't think so. The htslib headers need to be propagated for anything
> that uses header files from pysam, since they contain contain code such
> as "include <htslib/foo.h>". Perhaps you can update the comment to make
> it more clear?
>
> Patchelf is probably what made that work when htslib was bundled.
Ah, ok I see, so the problem is that python-plastid requires the .h 
files during build. Given that this is the only package that has an 
issue, and perhaps pysam doesn't intend to provide these .h files as 
part of it's "interface", I think it might be best to simply put htslib 
as an input to python-plastid. That all checks out, here's a patch 
series to do this plus update plastid. OK?

ben

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: pysam_patches20160926.patch --]
[-- Type: text/x-patch; name="pysam_patches20160926.patch", Size: 19706 bytes --]

From b5ce635ef019f95ee2857060cbab1b2d4994f021 Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Fri, 16 Sep 2016 18:05:15 +0100
Subject: [PATCH 01/10] gnu: python-pysam: Update to 0.9.1.4.

* gnu/packages/bioinformatics.scm (python-pysam, python2-pysam): Update
to 0.9.1.4.
---
 gnu/packages/bioinformatics.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index 1bf91a9..6e83461 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -1290,13 +1290,13 @@ multiple sequence alignments.")
 (define-public python-pysam
   (package
     (name "python-pysam")
-    (version "0.8.4")
+    (version "0.9.1.4")
     (source (origin
               (method url-fetch)
               (uri (pypi-uri "pysam" version))
               (sha256
                (base32
-                "1slx5mb94mzm5qzk52q270sab0sar95j67w1g1k452nz3s9j7krh"))))
+                "1i1djacqbr88y7w18b4aa78zxnsyr4sz7yqdq2spi7gs0y6pzvjn"))))
     (build-system python-build-system)
     (arguments
      `(#:tests? #f ; tests are excluded in the manifest
-- 
2.9.2


From 2f815c0435eb514f850c6bfa8b0996fd6d3cb538 Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Sat, 17 Sep 2016 10:33:28 +0100
Subject: [PATCH 02/10] gnu: Add python-pyxb.

* gnu/packages/xml.scm (python-pyxb, python2-pyxb): New variables.
---
 gnu/packages/xml.scm | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/gnu/packages/xml.scm b/gnu/packages/xml.scm
index 7befad5..cd3426b 100644
--- a/gnu/packages/xml.scm
+++ b/gnu/packages/xml.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is>
 ;;; Copyright © 2016 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2016 Marius Bakke <mbakke@fastmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -729,6 +730,30 @@ different Unicode encodings which happen automatically during
 parsing/saving.")
     (license license:expat)))
 
+(define-public python-pyxb
+  (package
+    (name "python-pyxb")
+    (version "1.2.5")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "PyXB" version))
+              (sha256
+               (base32
+                "0rzzwibfqa28gxgcxx4cybx1qcg0g6fand06ykj3gz7z5kp653sf"))))
+    (build-system python-build-system)
+    (home-page "http://pyxb.sourceforge.net/")
+    (synopsis "Python XML Schema Bindings")
+    (description
+     "PyXB (\"pixbee\") is a pure Python package that generates Python source
+code for classes that correspond to data structures defined by XMLSchema.")
+    (license (list license:asl2.0    ; Most files.
+                   license:expat     ; pyxb/utils/six.py
+                   license:gpl2      ; bundled jquery in doc is dual MIT/GPL2
+                   license:psfl))))  ; pyxb/utils/activestate.py
+
+(define-public python2-pyxb
+  (package-with-python2 python-pyxb))
+
 (define-public xmlto
   (package
     (name "xmlto")
-- 
2.9.2


From ee973d7f50f7a874a3917c3ea20bcc8e1c17cba3 Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Sat, 17 Sep 2016 10:42:56 +0100
Subject: [PATCH 03/10] gnu: python2-pbcore: Update to 1.2.10.

* gnu/packages/bioinformatics.scm (python2-pbcore): Update to 1.2.10.
[propagated-inputs]: New field. Add python2-pyxb.
---
 gnu/packages/bioinformatics.scm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index 6e83461..a935d5a 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -3376,13 +3376,13 @@ interrupted by stop codons.  OrfM finds and prints these ORFs.")
 (define-public python2-pbcore
   (package
     (name "python2-pbcore")
-    (version "1.2.8")
+    (version "1.2.10")
     (source (origin
               (method url-fetch)
               (uri (pypi-uri "pbcore" version))
               (sha256
                (base32
-                "02pfn5raa3zf739672bg0dkx7z3j2c4nx7vmpfjqy5b12jrqpymk"))))
+                "1kjmv891d6qbpp4shhhvkl02ff4q5xlpnls2513sm2cjcrs52f1i"))))
     (build-system python-build-system)
     (arguments `(#:python ,python-2)) ; pbcore requires Python 2.7
     (inputs
@@ -3395,6 +3395,8 @@ interrupted by stop codons.  OrfM finds and prints these ORFs.")
        ("python-nose" ,python2-nose)
        ("python-setuptools" ,python2-setuptools)
        ("python-sphinx" ,python2-sphinx)))
+    (propagated-inputs
+     `(("python-pyxb" ,python2-pyxb)))
     (home-page "http://pacificbiosciences.github.io/pbcore/")
     (synopsis "Library for reading and writing PacBio data files")
     (description
-- 
2.9.2


From cf8ad52987ea4c7cd3e01d317c71664be59077cb Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Thu, 22 Sep 2016 13:47:53 +0100
Subject: [PATCH 04/10] gnu: Add bcftools.

* gnu/packages/bioinformatics.scm (bcftools): New variable.
---
 gnu/packages/bioinformatics.scm | 58 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index a935d5a..679502e 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -265,6 +265,64 @@ instance, it implements several methods to assess contig-wise read coverage.")
 BAM files.")
     (license license:expat)))
 
+(define-public bcftools
+  (package
+    (name "bcftools")
+    (version "1.3.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "https://github.com/samtools/bcftools/releases/download/"
+                    version "/bcftools-" version ".tar.bz2"))
+              (sha256
+               (base32
+                "095ry68vmz9q5s1scjsa698dhgyvgw5aicz24c19iwfbai07mhqj"))
+              (modules '((guix build utils)))
+              (snippet
+               ;; Delete bundled htslib.
+               '(delete-file-recursively "htslib-1.3.1"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:test-target "test"
+       #:make-flags
+       (list
+        "USE_GPL=1"
+        (string-append "prefix=" (assoc-ref %outputs "out"))
+        (string-append "HTSDIR=" (assoc-ref %build-inputs "htslib") "/include")
+        (string-append "HTSLIB=" (assoc-ref %build-inputs "htslib") "/lib/libhts.a")
+        (string-append "BGZIP=" (assoc-ref %build-inputs "htslib") "/bin/bgzip")
+        (string-append "TABIX=" (assoc-ref %build-inputs "htslib") "/bin/tabix"))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-Makefile
+           (lambda _
+             (substitute* "Makefile"
+               ;; Do not attempt to build htslib.
+               (("^include \\$\\(HTSDIR\\)/htslib\\.mk") "")
+               ;; Link against GSL cblas.
+               (("-lcblas") "-lgslcblas"))
+             #t))
+         (delete 'configure)
+         (add-before 'check 'patch-tests
+           (lambda _
+             (substitute* "test/test.pl"
+               (("/bin/bash") (which "bash")))
+             #t)))))
+    (native-inputs
+     `(("htslib" ,htslib)
+       ("perl" ,perl)))
+    (inputs
+     `(("gsl" ,gsl)
+       ("zlib" ,zlib)))
+    (home-page "https://samtools.github.io/bcftools/")
+    (synopsis "Utilities for variant calling and manipulating VCFs and BCFs")
+    (description
+     "BCFtools is a set of utilities that manipulate variant calls in the
+Variant Call Format (VCF) and its binary counterpart BCF.  All commands work
+transparently with both VCFs and BCFs, both uncompressed and BGZF-compressed.")
+    ;; The sources are dual MIT/GPL, but becomes GPL-only when USE_GPL=1.
+    (license (list license:gpl3+ license:expat))))
+
 (define-public bedops
   (package
     (name "bedops")
-- 
2.9.2


From c55bb85fd088474c942e79f81d87cefa5a1db82e Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Fri, 23 Sep 2016 06:40:40 +0100
Subject: [PATCH 05/10] gnu: python-pysam: Use 'modify-phases'.

* gnu/packages/bioinformatics.scm (python-pysam)[arguments]: Use
'modify-phases'.
---
 gnu/packages/bioinformatics.scm | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index 679502e..518dfea 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -1359,12 +1359,12 @@ multiple sequence alignments.")
     (arguments
      `(#:tests? #f ; tests are excluded in the manifest
        #:phases
-       (alist-cons-before
-        'build 'set-flags
-        (lambda _
-          (setenv "LDFLAGS" "-lncurses")
-          (setenv "CFLAGS" "-D_CURSES_LIB=1"))
-        %standard-phases)))
+       (modify-phases %standard-phases
+         (add-before 'build 'set-flags
+           (lambda _
+             (setenv "LDFLAGS" "-lncurses")
+             (setenv "CFLAGS" "-D_CURSES_LIB=1")
+             #t)))))
     (inputs
      `(("ncurses"           ,ncurses)
        ("zlib"              ,zlib)))
-- 
2.9.2


From 745d7f1ed15b6b4c88a8d67e858fd76269312739 Mon Sep 17 00:00:00 2001
From: Ben J Woodcroft <donttrustben@gmail.com>
Date: Mon, 26 Sep 2016 13:54:42 +1000
Subject: [PATCH 06/10] gnu: python-plastid: Add input 'htslib'.

By default, plastid uses the .h files included with pysam when it is compiled
with the bundled htslib.  Since we will soon use an externally installed
htslib, we use htslib directly as an input to plastid.

* gnu/packages/bioinformatics.scm (python-plastid, python2-htslib)
[inputs]: New field.  Add 'htslib'.
---
 gnu/packages/bioinformatics.scm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index 518dfea..5e152b4 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -1436,6 +1436,8 @@ UCSC genome browser.")
     (native-inputs
      `(("python-cython" ,python-cython)
        ("python-nose" ,python-nose)))
+    (inputs
+     `(("htslib" ,htslib)))
     (home-page "https://github.com/joshuagryphon/plastid")
     (synopsis "Python library for genomic analysis")
     (description
-- 
2.9.2


From 31f4ba8b2e71c8c5f323eff3be5a93e408a86e31 Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Thu, 22 Sep 2016 14:08:05 +0100
Subject: [PATCH 07/10] gnu: python-pysam: Delete bundled htslib.

* gnu/packages/bioinformatics.scm (python-pysam)[source]: Add snippet
to delete htslib.
[arguments]: Add htslib flags in 'set-flags phase.
[inputs]: Add htslib.
---
 gnu/packages/bioinformatics.scm | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index 5e152b4..a99549c 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -1354,19 +1354,29 @@ multiple sequence alignments.")
               (uri (pypi-uri "pysam" version))
               (sha256
                (base32
-                "1i1djacqbr88y7w18b4aa78zxnsyr4sz7yqdq2spi7gs0y6pzvjn"))))
+                "1i1djacqbr88y7w18b4aa78zxnsyr4sz7yqdq2spi7gs0y6pzvjn"))
+              (modules '((guix build utils)))
+              (snippet
+               ;; Drop bundled htslib. TODO: Also remove samtools and bcftools.
+               '(delete-file-recursively "htslib"))))
     (build-system python-build-system)
     (arguments
      `(#:tests? #f ; tests are excluded in the manifest
        #:phases
        (modify-phases %standard-phases
          (add-before 'build 'set-flags
-           (lambda _
+           (lambda* (#:key inputs #:allow-other-keys)
+             (setenv "HTSLIB_MODE" "external")
+             (setenv "HTSLIB_LIBRARY_DIR"
+                     (string-append (assoc-ref inputs "htslib") "/lib"))
+             (setenv "HTSLIB_INCLUDE_DIR"
+                     (string-append (assoc-ref inputs "htslib") "/include"))
              (setenv "LDFLAGS" "-lncurses")
              (setenv "CFLAGS" "-D_CURSES_LIB=1")
              #t)))))
     (inputs
-     `(("ncurses"           ,ncurses)
+     `(("htslib"            ,htslib)
+       ("ncurses"           ,ncurses)
        ("zlib"              ,zlib)))
     (native-inputs
      `(("python-cython"     ,python-cython)
-- 
2.9.2


From 176c1b2992548aa3339a4d5d7fcda5cc20807c68 Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Thu, 22 Sep 2016 14:11:59 +0100
Subject: [PATCH 08/10] gnu: python-pysam: Enable tests.

* gnu/packages/bioinformatics.scm (python-pysam)[source]: Change from
PyPi to source archive due to missing test data.
[arguments]: Add check phase after install.
[native-inputs]: Add python-nose, samtools and bcftools.
---
 gnu/packages/bioinformatics.scm | 36 ++++++++++++++++++++++++++++++------
 1 file changed, 30 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index a99549c..d4c8320 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -1351,18 +1351,21 @@ multiple sequence alignments.")
     (version "0.9.1.4")
     (source (origin
               (method url-fetch)
-              (uri (pypi-uri "pysam" version))
+              ;; Test data is missing on PyPi.
+              (uri (string-append
+                    "https://github.com/pysam-developers/pysam/archive/v"
+                    version ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
               (sha256
                (base32
-                "1i1djacqbr88y7w18b4aa78zxnsyr4sz7yqdq2spi7gs0y6pzvjn"))
+                "0y41ssbg6nvn2jgcbnrvkzblpjcwszaiv1rgyd8dwzjkrbfsgsmc"))
               (modules '((guix build utils)))
               (snippet
                ;; Drop bundled htslib. TODO: Also remove samtools and bcftools.
                '(delete-file-recursively "htslib"))))
     (build-system python-build-system)
     (arguments
-     `(#:tests? #f ; tests are excluded in the manifest
-       #:phases
+     `(#:phases
        (modify-phases %standard-phases
          (add-before 'build 'set-flags
            (lambda* (#:key inputs #:allow-other-keys)
@@ -1373,14 +1376,35 @@ multiple sequence alignments.")
                      (string-append (assoc-ref inputs "htslib") "/include"))
              (setenv "LDFLAGS" "-lncurses")
              (setenv "CFLAGS" "-D_CURSES_LIB=1")
-             #t)))))
+             #t))
+         (delete 'check)
+         (add-after 'install 'check
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (setenv "PYTHONPATH"
+                     (string-append
+                      (getenv "PYTHONPATH")
+                      ":" (assoc-ref outputs "out")
+                      "/lib/python"
+                      (string-take (string-take-right
+                                    (assoc-ref inputs "python") 5) 3)
+                      "/site-packages"))
+             ;; Step out of source dir so python does not import from CWD.
+             (chdir "tests")
+             (setenv "HOME" "/tmp")
+             (and (zero? (system* "make" "-C" "pysam_data"))
+                  (zero? (system* "make" "-C" "cbcf_data"))
+                  (zero? (system* "nosetests" "-v"))))))))
     (inputs
      `(("htslib"            ,htslib)
        ("ncurses"           ,ncurses)
        ("zlib"              ,zlib)))
     (native-inputs
      `(("python-cython"     ,python-cython)
-       ("python-setuptools" ,python-setuptools)))
+       ("python-setuptools" ,python-setuptools)
+       ;; Dependencies below are are for tests only.
+       ("samtools"          ,samtools)
+       ("bcftools"          ,bcftools)
+       ("python-nose"       ,python-nose)))
     (home-page "https://github.com/pysam-developers/pysam")
     (synopsis "Python bindings to the SAMtools C API")
     (description
-- 
2.9.2


From 174b5b77deecdbadb67db3a3634e6d239edc8d30 Mon Sep 17 00:00:00 2001
From: Ben J Woodcroft <donttrustben@gmail.com>
Date: Mon, 26 Sep 2016 15:26:17 +1000
Subject: [PATCH 09/10] gnu: Add python-termcolor.

* gnu/packages/python.scm (python-termcolor, python2-termcolor): New
variables.
---
 gnu/packages/python.scm | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 688a5d4..529b7fd 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -6295,6 +6295,30 @@ a hash value.")
     (name "python2-tlsh")
     (inputs `(("python" ,python-2)))))
 
+(define-public python-termcolor
+  (package
+    (name "python-termcolor")
+    (version "1.1.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "python-termcolor" version))
+       (sha256
+        (base32
+         "0fv1vq14rpqwgazxg4981904lfyp84mnammw7y046491cv76jv8x"))))
+    (build-system python-build-system)
+    (arguments
+     ;; There are no tests.
+     `(#:tests? #f))
+    (home-page "http://pypi.python.org/pypi/termcolor")
+    (synopsis "ANSII Color formatting for terminal output")
+    (description
+     "This package provides ANSII Color formatting for output in terminals.")
+    (license license:expat)))
+
+(define-public python2-termcolor
+  (package-with-python2 python-termcolor))
+
 (define-public python-libarchive-c
   (package
     (name "python-libarchive-c")
-- 
2.9.2


From fa46350324fcfe203a70e947a2abd8c2488b6867 Mon Sep 17 00:00:00 2001
From: Ben J Woodcroft <donttrustben@gmail.com>
Date: Mon, 26 Sep 2016 14:19:29 +1000
Subject: [PATCH 10/10] gnu: python-plastid: Update to 1.4.6.

* gnu/packages/bioinformatics.scm (python-plastid, python2-plastid): Update to
1.4.6.
[propagated-inputs]: Add python-termcolor.
---
 gnu/packages/bioinformatics.scm | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index d4c8320..c2dc9a3 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -1447,13 +1447,13 @@ UCSC genome browser.")
 (define-public python-plastid
   (package
     (name "python-plastid")
-    (version "0.4.5")
+    (version "0.4.6")
     (source (origin
               (method url-fetch)
               (uri (pypi-uri "plastid" version))
               (sha256
                (base32
-                "1nhxw8a5gn9as58i2ih52c5cjwj48ik418pzsjwph3s66mmy9yvq"))))
+                "1sqkz5d3b9kf688mp7k771c87ins42j7j0whmkb49cb3fsg8s8lj"))))
     (properties `((python2-variant . ,(delay python2-plastid))))
     (build-system python-build-system)
     (arguments
@@ -1466,7 +1466,8 @@ UCSC genome browser.")
        ("python-pysam" ,python-pysam)
        ("python-matplotlib" ,python-matplotlib)
        ("python-biopython" ,python-biopython)
-       ("python-twobitreader" ,python-twobitreader)))
+       ("python-twobitreader" ,python-twobitreader)
+       ("python-termcolor" ,python-termcolor)))
     (native-inputs
      `(("python-cython" ,python-cython)
        ("python-nose" ,python-nose)))
-- 
2.9.2


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/3] gnu: Add python-pyxb.
  2016-09-26 11:15                       ` Ben Woodcroft
@ 2016-09-26 18:32                         ` Marius Bakke
  2016-09-27 11:01                           ` Ben Woodcroft
  2016-09-30 20:12                           ` Ludovic Courtès
  0 siblings, 2 replies; 18+ messages in thread
From: Marius Bakke @ 2016-09-26 18:32 UTC (permalink / raw)
  To: Ben Woodcroft, guix-devel@gnu.org

Ben Woodcroft <b.woodcroft@uq.edu.au> writes:

> On 24/09/16 13:15, Marius Bakke wrote:
>> Ben Woodcroft <b.woodcroft@uq.edu.au> writes:
>>
>>>> Htslib is propagated because it
>>>> is included by the installed samtools and bcftools headers; at least one
>>>> of pysams dependencies failed to build when it was a regular input.
>>> Ah, I see. Can this be avoided with patchelf?
>> I don't think so. The htslib headers need to be propagated for anything
>> that uses header files from pysam, since they contain contain code such
>> as "include <htslib/foo.h>". Perhaps you can update the comment to make
>> it more clear?
>>
>> Patchelf is probably what made that work when htslib was bundled.
> Ah, ok I see, so the problem is that python-plastid requires the .h 
> files during build. Given that this is the only package that has an 
> issue, and perhaps pysam doesn't intend to provide these .h files as 
> part of it's "interface", I think it might be best to simply put htslib 
> as an input to python-plastid.

I'm not sure, we would have to do this with every package that uses
the pysam cython interface. This particular issue is described in the
manual:

https://www.gnu.org/software/guix/manual/html_node/package-Reference.html

The propagated-inputs section says "For example this is necessary when a
C/C++ library needs headers of another library to compile, or when a
pkg-config file refers to another one via its Requires field.".

So I think it's a pretty common propagation scenario. See e.g. 618089f9
for a less convoluted case (C++ library that propagates zlib headers).

Perhaps a "propagated-build-inputs" functionality would be useful, so
that libraries are only propagated at build time and not to the profile.

If we don't do propagation, at least add a comment to python-plastid
explaining that htslib is there to avoid propagating from pysam, since
the plastid code contains no direct references to htslib.

Your other changes LGTM.

Thanks!
Marius

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/3] gnu: Add python-pyxb.
  2016-09-26 18:32                         ` Marius Bakke
@ 2016-09-27 11:01                           ` Ben Woodcroft
  2016-09-30 20:12                           ` Ludovic Courtès
  1 sibling, 0 replies; 18+ messages in thread
From: Ben Woodcroft @ 2016-09-27 11:01 UTC (permalink / raw)
  To: Marius Bakke, guix-devel@gnu.org

On 27/09/16 04:32, Marius Bakke wrote:
> Ben Woodcroft <b.woodcroft@uq.edu.au> writes:
>
>> On 24/09/16 13:15, Marius Bakke wrote:
>>> Ben Woodcroft <b.woodcroft@uq.edu.au> writes:
>>>
>>>>> Htslib is propagated because it
>>>>> is included by the installed samtools and bcftools headers; at least one
>>>>> of pysams dependencies failed to build when it was a regular input.
>>>> Ah, I see. Can this be avoided with patchelf?
>>> I don't think so. The htslib headers need to be propagated for anything
>>> that uses header files from pysam, since they contain contain code such
>>> as "include <htslib/foo.h>". Perhaps you can update the comment to make
>>> it more clear?
>>>
>>> Patchelf is probably what made that work when htslib was bundled.
>> Ah, ok I see, so the problem is that python-plastid requires the .h
>> files during build. Given that this is the only package that has an
>> issue, and perhaps pysam doesn't intend to provide these .h files as
>> part of it's "interface", I think it might be best to simply put htslib
>> as an input to python-plastid.
> I'm not sure, we would have to do this with every package that uses
> the pysam cython interface.
Ah, you're right. I overlooked the cython interface.

I pushed the series propagating htslib with pysam, ending in 99caa6f.

Thanks for persevering.
ben

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/3] gnu: Add python-pyxb.
  2016-09-26 18:32                         ` Marius Bakke
  2016-09-27 11:01                           ` Ben Woodcroft
@ 2016-09-30 20:12                           ` Ludovic Courtès
  1 sibling, 0 replies; 18+ messages in thread
From: Ludovic Courtès @ 2016-09-30 20:12 UTC (permalink / raw)
  To: Marius Bakke; +Cc: guix-devel@gnu.org

Hello,

Marius Bakke <mbakke@fastmail.com> skribis:

> I'm not sure, we would have to do this with every package that uses
> the pysam cython interface. This particular issue is described in the
> manual:
>
> https://www.gnu.org/software/guix/manual/html_node/package-Reference.html
>
> The propagated-inputs section says "For example this is necessary when a
> C/C++ library needs headers of another library to compile, or when a
> pkg-config file refers to another one via its Requires field.".
>
> So I think it's a pretty common propagation scenario. See e.g. 618089f9
> for a less convoluted case (C++ library that propagates zlib headers).
>
> Perhaps a "propagated-build-inputs" functionality would be useful, so
> that libraries are only propagated at build time and not to the profile.

FWIW, Nixpkgs makes (or made) this distinction, but I could not think of
a situation where it would make sense to propagate in one context and
not the other.

Ludo’.

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2016-09-30 20:12 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-17 10:10 [PATCH 0/3] gnu: python2-pbcore: Update to 1.2.10 Marius Bakke
2016-09-17 10:10 ` [PATCH 1/3] gnu: python-pysam: Update to 0.9.1.4 Marius Bakke
2016-09-17 10:10 ` [PATCH 2/3] gnu: Add python-pyxb Marius Bakke
     [not found]   ` <3bd16b58-b3d1-d47c-2433-c3a721681463@uq.edu.au>
2016-09-20  6:34     ` Ben Woodcroft
2016-09-20  7:06       ` Ben Woodcroft
2016-09-21 21:14         ` Marius Bakke
2016-09-22  0:46           ` Ben Woodcroft
2016-09-22 15:15             ` Marius Bakke
2016-09-23  1:28               ` Ben Woodcroft
2016-09-23 15:56                 ` Marius Bakke
2016-09-23 16:06                   ` Marius Bakke
2016-09-24  0:23                   ` Ben Woodcroft
2016-09-24  3:15                     ` Marius Bakke
2016-09-26 11:15                       ` Ben Woodcroft
2016-09-26 18:32                         ` Marius Bakke
2016-09-27 11:01                           ` Ben Woodcroft
2016-09-30 20:12                           ` Ludovic Courtès
2016-09-17 10:10 ` [PATCH 3/3] gnu: python2-pbcore: Update to 1.2.10 Marius Bakke

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.