<commit_before>#!/usr/bin/env python
import sys
import os
import shutil
from setuptools import setup, Extension

import numpy

BASEDIR = os.path.dirname(__file__)
NUMPY_INCLUDE = numpy.get_include()
EXTRA_C_ARGS = ["-O3", "-ffast-math"]

try:
    CYTHON_BUILD = True
    from Cython.Build import cythonize
    from Cython.Distutils import build_ext
    sys.path.append(os.path.join(BASEDIR, "external", "bx-python", "lib"))
except ImportError:
    CYTHON_BUILD = False


def _basedir(path):
    return os.path.join(BASEDIR, path)


def _link_source():
    exts = (".pyx", ".pxd") if CYTHON_BUILD else (".c", )

    for ext in exts:
        shutil.copy2(_basedir("PyMaSC/utils/bx/binary_{}_endian".format(sys.byteorder) + ext),
                     _basedir("PyMaSC/utils/bx/binary_file" + ext))


def _define_extension(name, include_numpy=False):
    ext = ".pyx" if CYTHON_BUILD else ".c"
    include_dirs = [NUMPY_INCLUDE] if include_numpy else []

    return Extension(
        name, sources=[_basedir(name.replace('.', '/') + ext)],
        include_dirs=include_dirs, extra_compile_args=EXTRA_C_ARGS
    )


def _get_setup_args():
    cmdclass = {} if not CYTHON_BUILD else {"build_ext": build_ext}
    ext_modules = [
        _define_extension(name, include_numpy=True) for name in (
            "PyMaSC.reader.bx.bbi_file",
            "PyMaSC.reader.bx.bigwig_file",
            "PyMaSC.reader.bigwig",
            "PyMaSC.core.mappability",
            "PyMaSC.core.ncc",
            "PyMaSC.core.mscc"
        )
    ] + [
        _define_extension(name) for name in (
            "PyMaSC.reader.bx.bpt_file",
            "PyMaSC.core.readlen",
            "PyMaSC.utils.bx.binary_file"
        )
    ]

    return cmdclass, ext_modules


def _setup():
    #
    _link_source()
    cmdclass, ext_modules = _get_setup_args()
    if CYTHON_BUILD:
        ext_modules = cythonize(ext_modules)

    #
    setup(
        name="PyMaSC",<commit_msg>add pysam include path<commit_after>#!/usr/bin/env python
import sys
import os
import shutil
from setuptools import setup, Extension

import numpy
import pysam

BASEDIR = os.path.dirname(__file__)
NUMPY_INCLUDE = numpy.get_include()
PYSAM_INCLUDE = pysam.__path__
EXTRA_C_ARGS = ["-O3", "-ffast-math"]

try:
    CYTHON_BUILD = True
    from Cython.Build import cythonize
    from Cython.Distutils import build_ext
    sys.path.append(os.path.join(BASEDIR, "external", "bx-python", "lib"))
except ImportError:
    CYTHON_BUILD = False


def _basedir(path):
    return os.path.join(BASEDIR, path)


def _link_source():
    exts = (".pyx", ".pxd") if CYTHON_BUILD else (".c", )

    for ext in exts:
        shutil.copy2(_basedir("PyMaSC/utils/bx/binary_{}_endian".format(sys.byteorder) + ext),
                     _basedir("PyMaSC/utils/bx/binary_file" + ext))


def _define_extension(name, include_numpy=False):
    ext = ".pyx" if CYTHON_BUILD else ".c"
    include_dirs = [NUMPY_INCLUDE] if include_numpy else []

    return Extension(
        name, sources=[_basedir(name.replace('.', '/') + ext)],
        include_dirs=include_dirs, extra_compile_args=EXTRA_C_ARGS
    )


def _get_setup_args():
    cmdclass = {} if not CYTHON_BUILD else {"build_ext": build_ext}
    ext_modules = [
        _define_extension(name, include_numpy=True) for name in (
            "PyMaSC.reader.bx.bbi_file",
            "PyMaSC.reader.bx.bigwig_file",
            "PyMaSC.reader.bigwig",
            "PyMaSC.core.mappability",
            "PyMaSC.core.ncc",
            "PyMaSC.core.mscc"
        )
    ] + [
        _define_extension(name) for name in (
            "PyMaSC.reader.bx.bpt_file",
            "PyMaSC.utils.bx.binary_file"
        )
    ] + [Extension(
        "PyMaSC.core.readlen",
        sources=[_basedir("PyMaSC/core/readlen" + ".pyx" if CYTHON_BUILD else ".c")],
        include_dirs=[PYSAM_INCLUDE],
        extra_compile_args=EXTRA_C_ARGS
    )]

    return cmdclass, ext_modules


def _setup():
    #
    _link_source()
    cmdclass, ext_modules = _get_setup_args()
    if CYTHON_BUILD:
        ext_modules = cythonize(ext_modules)

    #
    setup(
        name="PyMaSC",
{'fraction_non_alphanumeric': 0.12409288824383163, 'fraction_numerical': 0.0009675858732462506, 'mean_word_length': 2.765938069216758, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '690296', 'n_tokens_mistral': 1512, 'n_tokens_neox': 1458, 'n_words': 269}