| 1 |
import glob |
| 2 |
import sys |
| 3 |
import os |
| 4 |
|
| 5 |
from setuptools import setup, find_packages, Extension |
| 6 |
from Cython.Distutils import build_ext |
| 7 |
|
| 8 |
import pysam |
| 9 |
|
| 10 |
test_module_suffix = os.path.dirname(os.path.abspath(__file__)).split(os.sep)[-1] |
| 11 |
test_module_name = "PysamTestModule_{}".format(test_module_suffix) |
| 12 |
|
| 13 |
pysam_libraries = pysam.get_libraries() |
| 14 |
pysam_libdirs, pysam_libs = zip(*[os.path.split(x) for x in pysam_libraries]) |
| 15 |
pysam_libdir = pysam_libdirs[0] |
| 16 |
|
| 17 |
pysam_libs = [x[3:-3] for x in pysam_libs] |
| 18 |
|
| 19 |
TestModule = Extension( |
| 20 |
"{}.BuildRead".format(test_module_name), |
| 21 |
["{}/BuildRead.pyx".format(test_module_name)], |
| 22 |
include_dirs=pysam.get_include(), |
| 23 |
library_dirs=[pysam_libdir], |
| 24 |
libraries=pysam_libs, |
| 25 |
language="C", |
| 26 |
) |
| 27 |
|
| 28 |
setup( |
| 29 |
name=test_module_name, |
| 30 |
version='0.1', |
| 31 |
packages=find_packages(), |
| 32 |
package_dir={test_module_name: test_module_name}, |
| 33 |
ext_modules=[TestModule], |
| 34 |
cmdclass={'build_ext': build_ext}, |
| 35 |
) |