1from setuptools import setup, Extension
2from codecs import open
3import os
4
5cmdclass = {}
6long_description = ""
7
8# Build directly from cython source file(s) if user wants so (probably for some experiments).
9# Otherwise, pre-generated c source file(s) are used.
10# User has to set environment variable EDLIB_USE_CYTHON.
11# e.g.: EDLIB_USE_CYTHON=1 python setup.py install
12USE_CYTHON = os.getenv('EDLIB_USE_CYTHON', False)
13if USE_CYTHON:
14    from Cython.Build import build_ext
15    edlib_module_src = "edlib.pyx"
16    cmdclass['build_ext'] = build_ext
17else:
18    edlib_module_src = "edlib.bycython.cpp"
19
20# Load README.rst into long description.
21# User can skip using README.rst as long description: EDLIB_OMIT_README_RST=1 python setup.py install
22OMIT_README_RST = os.getenv('EDLIB_OMIT_README_RST', False)
23if not OMIT_README_RST:
24    here = os.path.abspath(os.path.dirname(__file__))
25    with open(os.path.join(here, 'README.rst'), encoding='utf-8') as f:
26        long_description = f.read()
27
28setup(
29    # Information
30    name = "edlib",
31    description = "Lightweight, super fast library for sequence alignment using edit (Levenshtein) distance.",
32    long_description = long_description,
33    version = "1.3.8.post2",
34    url = "https://github.com/Martinsos/edlib",
35    author = "Martin Sosic",
36    author_email = "sosic.martin@gmail.com",
37    license = "MIT",
38    keywords = "edit distance levenshtein align sequence bioinformatics",
39    # Build instructions
40    ext_modules = [Extension("edlib",
41                             [edlib_module_src, "edlib/src/edlib.cpp"],
42                             include_dirs=["edlib/include"],
43                             depends=["edlib/include/edlib.h"],
44                             language="c++",
45                             extra_compile_args=["-O3", "-std=c++11"])],
46    cmdclass = cmdclass
47)
48