| 1 |
#!/usr/bin/env python3 |
| 2 |
|
| 3 |
import setuptools |
| 4 |
from setuptools.extension import Extension |
| 5 |
from Cython.Build import cythonize |
| 6 |
import numpy as np |
| 7 |
|
| 8 |
# I'd prefer not to include static zstd here, but I get build problems on macOS |
| 9 |
# without it. |
| 10 |
clib = ('clib', |
| 11 |
{'sources': ['src/plink2/libdeflate/lib/adler32.c', |
| 12 |
'src/plink2/libdeflate/lib/crc32.c', |
| 13 |
'src/plink2/libdeflate/lib/deflate_compress.c', |
| 14 |
'src/plink2/libdeflate/lib/deflate_decompress.c', |
| 15 |
'src/plink2/libdeflate/lib/gzip_compress.c', |
| 16 |
'src/plink2/libdeflate/lib/gzip_decompress.c', |
| 17 |
'src/plink2/libdeflate/lib/utils.c', |
| 18 |
'src/plink2/libdeflate/lib/zlib_compress.c', |
| 19 |
'src/plink2/libdeflate/lib/zlib_decompress.c', |
| 20 |
'src/plink2/libdeflate/lib/arm/arm_cpu_features.c', |
| 21 |
'src/plink2/libdeflate/lib/x86/x86_cpu_features.c', |
| 22 |
'src/plink2/zstd/lib/common/debug.c', |
| 23 |
'src/plink2/zstd/lib/common/entropy_common.c', |
| 24 |
'src/plink2/zstd/lib/common/error_private.c', |
| 25 |
'src/plink2/zstd/lib/common/fse_decompress.c', |
| 26 |
'src/plink2/zstd/lib/common/pool.c', |
| 27 |
'src/plink2/zstd/lib/common/threading.c', |
| 28 |
'src/plink2/zstd/lib/common/xxhash.c', |
| 29 |
'src/plink2/zstd/lib/common/zstd_common.c', |
| 30 |
'src/plink2/zstd/lib/compress/fse_compress.c', |
| 31 |
'src/plink2/zstd/lib/compress/hist.c', |
| 32 |
'src/plink2/zstd/lib/compress/huf_compress.c', |
| 33 |
'src/plink2/zstd/lib/compress/zstd_compress.c', |
| 34 |
'src/plink2/zstd/lib/compress/zstd_compress_literals.c', |
| 35 |
'src/plink2/zstd/lib/compress/zstd_compress_sequences.c', |
| 36 |
'src/plink2/zstd/lib/compress/zstd_compress_superblock.c', |
| 37 |
'src/plink2/zstd/lib/compress/zstd_double_fast.c', |
| 38 |
'src/plink2/zstd/lib/compress/zstd_fast.c', |
| 39 |
'src/plink2/zstd/lib/compress/zstd_lazy.c', |
| 40 |
'src/plink2/zstd/lib/compress/zstd_ldm.c', |
| 41 |
'src/plink2/zstd/lib/compress/zstd_opt.c', |
| 42 |
'src/plink2/zstd/lib/compress/zstdmt_compress.c', |
| 43 |
'src/plink2/zstd/lib/decompress/huf_decompress.c', |
| 44 |
'src/plink2/zstd/lib/decompress/zstd_ddict.c', |
| 45 |
'src/plink2/zstd/lib/decompress/zstd_decompress.c', |
| 46 |
'src/plink2/zstd/lib/decompress/zstd_decompress_block.c'], |
| 47 |
'macros': [('ZSTD_DISABLE_ASM', None), ('LIBDEFLATE_STATIC', None)], |
| 48 |
'include_dirs': ['src/plink2/libdeflate'] |
| 49 |
}) |
| 50 |
|
| 51 |
ext_modules = [ |
| 52 |
Extension('pgenlib', |
| 53 |
sources = ['src/pgenlib/pgenlib.pyx', |
| 54 |
'src/plink2/include/pgenlib_ffi_support.cc', |
| 55 |
'src/plink2/include/pvar_ffi_support.cc', |
| 56 |
'src/plink2/include/pgenlib_misc.cc', |
| 57 |
'src/plink2/include/pgenlib_read.cc', |
| 58 |
'src/plink2/include/pgenlib_write.cc', |
| 59 |
'src/plink2/include/plink2_base.cc', |
| 60 |
'src/plink2/include/plink2_bgzf.cc', |
| 61 |
'src/plink2/include/plink2_bits.cc', |
| 62 |
'src/plink2/include/plink2_htable.cc', |
| 63 |
'src/plink2/include/plink2_memory.cc', |
| 64 |
'src/plink2/include/plink2_string.cc', |
| 65 |
'src/plink2/include/plink2_text.cc', |
| 66 |
'src/plink2/include/plink2_thread.cc', |
| 67 |
'src/plink2/include/plink2_zstfile.cc'], |
| 68 |
language = "c++", |
| 69 |
# do not compile as c++11, since cython doesn't yet support |
| 70 |
# overload of uint32_t operator |
| 71 |
# extra_compile_args = ["-std=c++11", "-Wno-unused-function"], |
| 72 |
# extra_link_args = ["-std=c++11"], |
| 73 |
extra_compile_args = ["-std=c++98", "-Wno-unused-function", "-Wno-macro-redefined", "-Wno-c++11-extensions", "-Wno-cpp", "-DZSTD_DISABLE_ASM", "-DLIBDEFLATE_STATIC"], |
| 74 |
extra_link_args = ["-std=c++98", "-lz"], |
| 75 |
include_dirs = [np.get_include()] + ['src/plink2/libdeflate'] |
| 76 |
) |
| 77 |
] |
| 78 |
|
| 79 |
with open("README.md", "r", encoding="utf-8") as fh: |
| 80 |
long_description = fh.read() |
| 81 |
|
| 82 |
setuptools.setup( |
| 83 |
name="Pgenlib", |
| 84 |
version="0.92.0", |
| 85 |
author="Christopher Chang", |
| 86 |
author_email="[email protected]", |
| 87 |
description="Python wrapper for pgenlib's basic reader and writer.", |
| 88 |
long_description=long_description, |
| 89 |
long_description_content_type="text/markdown", |
| 90 |
url="https://github.com/chrchang/plink-ng", |
| 91 |
project_urls={ |
| 92 |
"Bug Tracker": "https://github.com/chrchang/plink-ng/issues", |
| 93 |
}, |
| 94 |
classifiers=[ |
| 95 |
"Programming Language :: Python :: 3", |
| 96 |
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)", |
| 97 |
"Operating System :: OS Independent", |
| 98 |
], |
| 99 |
package_dir={"": "src"}, |
| 100 |
packages=setuptools.find_namespace_packages(where="src"), |
| 101 |
python_requires=">=3.5", |
| 102 |
libraries=[clib], |
| 103 |
ext_modules=cythonize(ext_modules), |
| 104 |
install_requires = [ |
| 105 |
"numpy>=1.19.0", |
| 106 |
], |
| 107 |
) |