1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
try:
from setuptools import setup, Extension
from setuptools.command.install import install
except ImportError:
from distutils.core import setup
from distutils.extension import Extension
import sys
import platform
import os
include_dirs = []
# import numpy as np
# creat dummy closures for metadata reading on first parse of setup.py
# that way it picks up the requirements and installs them, then can use them
# for the install.
try:
import numpy as np
include_dirs = ['include/', np.get_include() ]
except ImportError:
include_dirs = ['include/']
def np(*args, ** kwargs ):
import numpy as np
return np(*args, ** kwargs)
try:
from Cython.Build import build_ext
except ImportError:
def build_ext(*args, ** kwargs ):
from Cython.Build import build_ext
return build_ext(*args, ** kwargs)
# from Cython.Build import build_ext
#adapted from https://github.com/lh3/minimap2/blob/master/setup.py
sources=['python/pyslow5.pyx', 'src/slow5.c', 'src/slow5_press.c', 'src/slow5_misc.c', 'src/slow5_idx.c',
'python/slow5threads.c',
]
depends=['python/pyslow5.pxd', 'python/pyslow5.h',
'python/slow5threads.h',
'slow5/slow5.h', 'slow5/slow5_defs.h', 'slow5/slow5_error.h', 'slow5/slow5_press.h',
'slow5/klib/khash.h', 'slow5/klib/kvec.h',
'src/slow5_extra.h', 'src/slow5_idx.h', 'src/slow5_misc.h', 'src/klib/ksort.h',
]
extra_compile_args = ['-g', '-Wall', '-O2', '-std=c99']
# extra_compile_args = []
# os.environ["CFLAGS"] = '-g -Wall -O2 -std=c99'
# include_dirs = ['include/', np.get_include() ]
libraries = ['m', 'z', 'streamvbyte']
library_dirs = ['.']
# a nasty hack to provide option to build with zstd
zstd=0
try:
zstd=os.environ["PYSLOW5_ZSTD"]
except:
zstd=0
if zstd=="1":
extra_compile_args.append('-DSLOW5_USE_ZSTD=1')
libraries.append('zstd')
extensions = [Extension('pyslow5',
sources = sources,
depends = depends,
extra_compile_args = extra_compile_args,
libraries = libraries,
include_dirs = include_dirs,
library_dirs = library_dirs,
language = 'c' )]
def readme():
with open('docs/pyslow5_api/pyslow5.md') as f:
return f.read()
setup(
name = 'pyslow5',
version='0.7.0',
url = 'https://github.com/hasindu2008/slow5lib',
description='slow5lib python bindings',
long_description=readme(),
long_description_content_type='text/markdown',
author='Hasindu Gamaarachchi, Sasha Jenner, James Ferguson',
author_email='hasindu2008@gmail.com',
maintainer='Hasindu Gamaarachchi',
maintainer_email='hasindu2008@gmail.com',
license = 'MIT',
keywords = ['nanopore','slow5','signal'],
ext_modules=extensions,
cmdclass= {'build_ext': build_ext},
classifiers = [
'Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: MIT License',
'Programming Language :: C',
'Programming Language :: Cython',
'Programming Language :: Python :: 3',
'Intended Audience :: Science/Research',
'Topic :: Scientific/Engineering :: Bio-Informatics'],
python_requires='>=3.4.3',
install_requires=["numpy"],
setup_requires=["Cython", "numpy"]
)
|