Tweaks for building extensions between release and development mode.

def maybe_cythonize_extensions(top_path, config):
    """Tweaks for building extensions between release and development mode."""
    is_release = os.path.exists(os.path.join(top_path, 'PKG-INFO'))

    if is_release:
        build_from_c_and_cpp_files(config.ext_modules)
    else:
        message = ('Please install cython with a version >= {0} in order '
                   'to build a scikit-survival development version.').format(
                       CYTHON_MIN_VERSION)
        try:
            import Cython
            if LooseVersion(Cython.__version__) < CYTHON_MIN_VERSION:
                message += ' Your version of Cython was {0}.'.format(
                    Cython.__version__)
                raise ValueError(message)
            from Cython.Build import cythonize
        except ImportError as exc:
            exc.args += (message,)
            raise

        # http://docs.cython.org/en/latest/src/userguide/source_files_and_compilation.html#cythonize-arguments
        directives = {'language_level': '3'}
        cy_cov = os.environ.get('CYTHON_COVERAGE', False)
        if cy_cov:
            directives['linetrace'] = True
            macros = [('CYTHON_TRACE', '1'), ('CYTHON_TRACE_NOGIL', '1')]
        else:
            macros = []

        config.ext_modules = cythonize(
            config.ext_modules,
            compiler_directives=directives)

        for e in config.ext_modules:
            e.define_macros.extend(macros)