From 779e80b7c1a75f458b4f4525be8515af76727e89 Mon Sep 17 00:00:00 2001 From: Luke Diorio-Toth Date: Mon, 27 Feb 2023 16:25:21 -0600 Subject: [PATCH] Package/py pysam macos (#33851) * cleaned up style, linked to external htslib * removed htslib/bcfrools/samtools deps, use bundled libs instead the pysam package includes the necessary libs to link to, so it wasn't even using linked libs when building * fixed style * revert to using external htslib currently uses bundled samtools and bcftools, and there is no way to use external versions for those dependencies * added libs property to htslibs package added support for lib64 * added htslib name --- .../repos/builtin/packages/htslib/package.py | 4 ++++ .../repos/builtin/packages/py-pysam/package.py | 15 +++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/var/spack/repos/builtin/packages/htslib/package.py b/var/spack/repos/builtin/packages/htslib/package.py index 7305661d0c..b2c5a0ac01 100644 --- a/var/spack/repos/builtin/packages/htslib/package.py +++ b/var/spack/repos/builtin/packages/htslib/package.py @@ -52,6 +52,10 @@ class Htslib(AutotoolsPackage): depends_on("automake", when="@1.2") depends_on("libtool", when="@1.2") + @property + def libs(self): + return find_libraries("libhts", root=self.prefix, recursive=True) + # v1.2 uses the automagically assembled tarball from .../archive/... # everything else uses the tarballs uploaded to the release def url_for_version(self, version): diff --git a/var/spack/repos/builtin/packages/py-pysam/package.py b/var/spack/repos/builtin/packages/py-pysam/package.py index afacbee9bf..2b98316c15 100644 --- a/var/spack/repos/builtin/packages/py-pysam/package.py +++ b/var/spack/repos/builtin/packages/py-pysam/package.py @@ -26,11 +26,18 @@ class PyPysam(PythonPackage): depends_on("py-cython@0.21:", when="@0.14:", type="build") depends_on("py-cython@0.17:", type="build") depends_on("curl") - depends_on("bcftools") - depends_on("htslib") - depends_on("samtools") - + depends_on("xz") depends_on("htslib@:1.6", when="@:0.13") + depends_on("htslib") def setup_build_environment(self, env): env.set("LDFLAGS", self.spec["curl"].libs.search_flags) + # this flag is supposed to be removed by cy_build.py, but for some reason isn't + if self.spec.platform == "darwin": + env.remove_flags("LDSHARED", "-bundle") + # linking htslib, see: + # http://pysam.readthedocs.org/en/latest/installation.html#external + # https://github.com/pysam-developers/pysam/blob/v0.9.0/setup.py#L79 + env.set("HTSLIB_MODE", "external") + env.set("HTSLIB_LIBRARY_DIR", self.spec["htslib"].libs.directories[0]) + env.set("HTSLIB_INCLUDE_DIR", self.spec["htslib"].headers.directories[0])