<commit_before>find_package(SWIG REQUIRED)
include(${SWIG_USE_FILE})
find_package(PythonLibs)
include_directories(${PYTHON_INCLUDE_PATH})
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_SWIG_FLAGS "")
swig_add_module(rlite python rlite.i)
# Tell the build system to link the _rlite.so python module against
# the librlite.so library
swig_link_libraries(rlite ${PYTHON_LIBRARIES} rlite)

# Installation directives
execute_process(COMMAND python -c "from distutils import sysconfig; print(sysconfig.get_python_lib(plat_specific=True, prefix='${CMAKE_INSTALL_PREFIX}'))"
                OUTPUT_VARIABLE _ABS_PYTHON_MODULE_PATH
                OUTPUT_STRIP_TRAILING_WHITESPACE)
get_filename_component(_ABS_PYTHON_MODULE_PATH ${_ABS_PYTHON_MODULE_PATH} ABSOLUTE)
file(RELATIVE_PATH _REL_PYTHON_MODULE_PATH ${CMAKE_INSTALL_PREFIX} ${_ABS_PYTHON_MODULE_PATH})
set(PYTHON_MODULE_PATH ${_REL_PYTHON_MODULE_PATH})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${SWIG_MODULE_rlite_REAL_NAME}.so DESTINATION ${PYTHON_MODULE_PATH})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/rlite.py DESTINATION ${PYTHON_MODULE_PATH})<commit_msg>swig: make SWIG bindings optional<commit_after>find_package(SWIG)
find_package(PythonLibs)

if (NOT SWIG_FOUND)
    message("SWIG not found: Python bindings will not be built")
elseif(NOT PYTHONLIBS_FOUND)
    message("Python not found: Python bindings will not be built")
else()
    include(${SWIG_USE_FILE})
    include_directories(${PYTHON_INCLUDE_PATH})
    include_directories(${CMAKE_CURRENT_SOURCE_DIR})
    set(CMAKE_SWIG_FLAGS "")
    swig_add_module(rlite python rlite.i)
    # Tell the build system to link the _rlite.so python module against
# the librlite.so library
    swig_link_libraries(rlite ${PYTHON_LIBRARIES} rlite)

    # Installation directives
    execute_process(COMMAND python -c "from distutils import sysconfig; print(sysconfig.get_python_lib(plat_specific=True, prefix='${CMAKE_INSTALL_PREFIX}'))"
                    OUTPUT_VARIABLE _ABS_PYTHON_MODULE_PATH
                    OUTPUT_STRIP_TRAILING_WHITESPACE)
    get_filename_component(_ABS_PYTHON_MODULE_PATH ${_ABS_PYTHON_MODULE_PATH} ABSOLUTE)
    file(RELATIVE_PATH _REL_PYTHON_MODULE_PATH ${CMAKE_INSTALL_PREFIX} ${_ABS_PYTHON_MODULE_PATH})
    set(PYTHON_MODULE_PATH ${_REL_PYTHON_MODULE_PATH})
    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${SWIG_MODULE_rlite_REAL_NAME}.so DESTINATION ${PYTHON_MODULE_PATH})
    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/rlite.py DESTINATION ${PYTHON_MODULE_PATH})
endif()
{'fraction_non_alphanumeric': 0.08617950754567116, 'fraction_numerical': 0.0, 'mean_word_length': 7.178571428571429, 'pattern_counts': {'":': 0, '<': 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': '2949808', 'n_tokens_mistral': 938, 'n_tokens_neox': 884, 'n_words': 143}