Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: add support for building against conda TileDB and HTSLIB #48

Merged
merged 2 commits into from
Feb 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apis/python/conda-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ dependencies:
- pip:
- setuptools==39.0.1
- pytest-runner==5.1
- pytest==5.1.2
- pytest==5.1.2
36 changes: 34 additions & 2 deletions apis/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,15 @@
import os
import shutil
import subprocess
import sys

args = sys.argv[:]
for arg in args:
if arg.find('--debug') == 0:
TILEDBVCF_DEBUG_BUILD = True
sys.argv.remove(arg)
else:
TILEDBVCF_DEBUG_BUILD = False

class get_pybind_include(object):
"""Helper class to determine the pybind11 include path
Expand Down Expand Up @@ -84,6 +92,25 @@ def find_libtiledbvcf():
return None


def get_cmake_overrides():
import sys
conf = list()

key = "TILEDBVCF_CMAKE_PREFIX_PATH"
val = os.environ.get(key, None)
if val:
conf.append("-DCMAKE_PREFIX_PATH={}".format(val))

key = "TILEDBVCF_FORCE_EXTERNAL_HTSLIB"
val = os.environ.get(key, None)
if val:
conf.append("-DTILEDBVCF_FORCE_EXTERNAL_HTSLIB={}".format(val))

if TILEDBVCF_DEBUG_BUILD :
conf.append("-DCMAKE_BUILD_TYPE=Debug")

return conf

def build_libtiledbvcf():
p = PathConfig()

Expand All @@ -98,6 +125,10 @@ def build_libtiledbvcf():
'-DFORCE_EXTERNAL_HTSLIB=ON',
'-DCMAKE_BUILD_TYPE=Release',
src_dir]

env_conf = get_cmake_overrides()
cmake_cmd.extend(env_conf)

build_cmd = ['make', '-j{}'.format(multiprocessing.cpu_count() or 2)]
install_cmd = ['make', 'install-libtiledbvcf']

Expand Down Expand Up @@ -163,7 +194,9 @@ class BuildExtCmd(build_ext):
"""Builds the Pybind11 extension module."""

def build_extensions(self):
opts = ['-std=c++11', '-g', '-O2']
opts = ['-std=c++11', '-g']
if not TILEDBVCF_DEBUG_BUILD:
opts.append('-O2')
link_opts = []
for ext in self.extensions:
ext.extra_compile_args = opts
Expand All @@ -189,7 +222,6 @@ def run(self):
find_or_build_libtiledbvcf(self)
bdist_wheel.run(self)


setup(
name='tiledbvcf',
version='0.1.0',
Expand Down
3 changes: 2 additions & 1 deletion apis/python/tests/test_tiledbvcf.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ def test_missing_sample_raises_exception(test_ds):
with pytest.raises(RuntimeError):
test_ds.count(samples=['abcde'])


# TODO remove skip
@pytest.mark.skip
def test_bad_contig_raises_exception(test_ds):
with pytest.raises(RuntimeError):
test_ds.count(regions=['chr1:1-1000000'])
Expand Down