From bcff0a2b53414b4b17a713044d5b910db76cda44 Mon Sep 17 00:00:00 2001 From: Afif Elghraoui Date: Sat, 5 Mar 2016 16:36:03 -0800 Subject: [PATCH] Update patch for external HTSlib --- debian/patches/external-htslib.patch | 84 ++++++++++++++++++++++++++ debian/patches/ignore-htslib-dir.patch | 27 --------- debian/patches/series | 2 +- 3 files changed, 85 insertions(+), 28 deletions(-) create mode 100644 debian/patches/external-htslib.patch delete mode 100644 debian/patches/ignore-htslib-dir.patch diff --git a/debian/patches/external-htslib.patch b/debian/patches/external-htslib.patch new file mode 100644 index 0000000..9160eb8 --- /dev/null +++ b/debian/patches/external-htslib.patch @@ -0,0 +1,84 @@ +Description: Fix external htslib support +Author: Afif Elghraoui +Forwarded: no +Last-Update: 2016-03-05 +--- python-pysam.orig/setup.py ++++ python-pysam/setup.py +@@ -87,10 +87,20 @@ + # pysam. + # external: use shared libhts.so compiled outside of + # pysam +-HTSLIB_MODE = "shared" ++HTSLIB_MODE = os.environ.get("HTSLIB_MODE","shared") + HTSLIB_LIBRARY_DIR = os.environ.get("HTSLIB_LIBRARY_DIR", None) + HTSLIB_INCLUDE_DIR = os.environ.get("HTSLIB_INCLUDE_DIR", None) + HTSLIB_CONFIGURE_OPTIONS = os.environ.get("HTSLIB_CONFIGURE_OPTIONS", None) ++HTSLIB_SOURCE = None ++ ++package_list = ['pysam', ++ 'pysam.include', ++ 'pysam.include.samtools', ++ 'pysam.include.bcftools', ++ 'pysam.include.samtools.win32'] ++package_dirs = {'pysam': 'pysam', ++ 'pysam.include.samtools': 'samtools', ++ 'pysam.include.bcftools': 'bcftools'} + + # Check if cython is available + # +@@ -101,13 +111,15 @@ + from cy_build import CyExtension as Extension, cy_build_ext as build_ext + source_pattern = "pysam/c%s.pyx" + cmdclass = {'build_ext': build_ext} +- HTSLIB_MODE = "shared" ++ if HTSLIB_MODE != "external": ++ HTSLIB_MODE = "shared" + except ImportError: + # no Cython available - use existing C code + cmdclass = {} + source_pattern = "pysam/c%s.c" + # Set mode to separate, as "shared" not fully tested yet. +- HTSLIB_MODE = "separate" ++ if HTSLIB_MODE != "external": ++ HTSLIB_MODE = "separate" + + # collect pysam version + sys.path.insert(0, "pysam") +@@ -140,6 +152,10 @@ + htslib_configure_options = None + + if HTSLIB_MODE in ['shared', 'separate']: ++ package_list += ['pysam.include.htslib', ++ 'pysam.include.htslib.htslib'] ++ package_dirs.update({'pysam.include.htslib':'htslib'}) ++ + htslib_configure_options = configure_library( + "htslib", + HTSLIB_CONFIGURE_OPTIONS, +@@ -492,13 +508,7 @@ + 'license': "MIT", + 'platforms': "ALL", + 'url': "https://github.com/pysam-developers/pysam", +- 'packages': ['pysam', +- 'pysam.include', +- 'pysam.include.htslib', +- 'pysam.include.htslib.htslib', +- 'pysam.include.samtools', +- 'pysam.include.bcftools', +- 'pysam.include.samtools.win32'], ++ 'packages': package_list, + 'requires': ['cython (>=0.21)'], + 'ext_modules': [chtslib, + csamfile, +@@ -511,10 +521,7 @@ + cfaidx, + cutils], + 'cmdclass': cmdclass, +- 'package_dir': {'pysam': 'pysam', +- 'pysam.include.htslib': 'htslib', +- 'pysam.include.samtools': 'samtools', +- 'pysam.include.bcftools': 'bcftools'}, ++ 'package_dir': package_dirs, + 'package_data': {'': ['*.pxd', '*.h'], }, + # do not pack in order to permit linking to csamtools.so + 'zip_safe': False, diff --git a/debian/patches/ignore-htslib-dir.patch b/debian/patches/ignore-htslib-dir.patch deleted file mode 100644 index 395ff4f..0000000 --- a/debian/patches/ignore-htslib-dir.patch +++ /dev/null @@ -1,27 +0,0 @@ -Description: Allow setup.py to cope with missing htslib copy - The build system expects the convenience copy to be present. - This change allows the build to work without it. After all, - we're linking with the Debian htslib package. -Author: Afif Elghraoui -Last-Update: 2015-06-24 ---- -This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ ---- python-pysam.orig/setup.py -+++ python-pysam/setup.py -@@ -494,8 +494,6 @@ - 'url': "https://github.com/pysam-developers/pysam", - 'packages': ['pysam', - 'pysam.include', -- 'pysam.include.htslib', -- 'pysam.include.htslib.htslib', - 'pysam.include.samtools', - 'pysam.include.bcftools', - 'pysam.include.samtools.win32'], -@@ -512,7 +510,6 @@ - cutils], - 'cmdclass': cmdclass, - 'package_dir': {'pysam': 'pysam', -- 'pysam.include.htslib': 'htslib', - 'pysam.include.samtools': 'samtools', - 'pysam.include.bcftools': 'bcftools'}, - 'package_data': {'': ['*.pxd', '*.h'], }, diff --git a/debian/patches/series b/debian/patches/series index 878b584..2417565 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,2 +1,2 @@ -ignore-htslib-dir.patch +external-htslib.patch disable-tests-requiring-network.patch -- 2.30.2