<commit_before># Scripts that modify LD_LIBRARY_PATH and such

# Adds a single path to a path-file
function(_add_to_a_path_single THISFILE path)
    if("${path}" STREQUAL "" OR "${path}" MATCHES "NOTFOUND")
        return()
    endif()
    # If quacks like a library, get directory where it resides
    get_filename_component(extension "${path}" EXT)
    if("${extension}" MATCHES "\\.so.*" OR "${extension}" MATCHES "\\.dylib")
        get_filename_component(path "${path}" PATH)
    elseif("${extension}" MATCHES "\\.a")
        return() # Archive are not dynamic, no need to add to rpath.
    endif()
    # Makes it an absolute path
    get_filename_component(path "${path}" ABSOLUTE)
    # Add to path file if not there yet
    if(NOT EXISTS "${THISFILE}")
        file(WRITE "${THISFILE}" "${path}\n")
    else()
        file(STRINGS "${THISFILE}" ALLPATHS)
        list(FIND ALLPATHS "${path}" INDEX)
        if(INDEX EQUAL -1)
            file(APPEND "${THISFILE}" "${path}\n")
        endif()
    endif()
endfunction()
# Adds many paths to a path file
function(_add_to_a_path THISFILE)
    foreach(path ${ARGN})
        file(GLOB these_files "${path}")
        _add_to_a_path_single("${THISFILE}" "${these_files}")
    endforeach()
endfunction()

function(add_to_ld_path)
    _add_to_a_path("${PROJECT_BINARY_DIR}/paths/ldpaths" ${ARGN})
endfunction()
function(add_to_python_path)
    _add_to_a_path("${PROJECT_BINARY_DIR}/paths/pypaths.pth" ${ARGN})
endfunction()

# Gets list of eggs in given directories<commit_msg>Remove glob that doesn't work on older cmakes<commit_after># Scripts that modify LD_LIBRARY_PATH and such

# Adds a single path to a path-file
function(_add_to_a_path_single THISFILE path)
    if("${path}" STREQUAL "" OR "${path}" MATCHES "NOTFOUND")
        return()
    endif()
    # If quacks like a library, get directory where it resides
    get_filename_component(extension "${path}" EXT)
    if("${extension}" MATCHES "\\.so.*" OR "${extension}" MATCHES "\\.dylib")
        get_filename_component(path "${path}" PATH)
    elseif("${extension}" MATCHES "\\.a")
        return() # Archive are not dynamic, no need to add to rpath.
    endif()
    # Makes it an absolute path
    get_filename_component(path "${path}" ABSOLUTE)
    # Add to path file if not there yet
    if(NOT EXISTS "${THISFILE}")
        file(WRITE "${THISFILE}" "${path}\n")
    else()
        file(STRINGS "${THISFILE}" ALLPATHS)
        list(FIND ALLPATHS "${path}" INDEX)
        if(INDEX EQUAL -1)
            file(APPEND "${THISFILE}" "${path}\n")
        endif()
    endif()
endfunction()
# Adds many paths to a path file
function(_add_to_a_path THISFILE)
    foreach(path ${ARGN})
        _add_to_a_path_single("${THISFILE}" "${these_files}")
    endforeach()
endfunction()

function(add_to_ld_path)
    _add_to_a_path("${PROJECT_BINARY_DIR}/paths/ldpaths" ${ARGN})
endfunction()
function(add_to_python_path)
    _add_to_a_path("${PROJECT_BINARY_DIR}/paths/pypaths.pth" ${ARGN})
endfunction()

# Gets list of eggs in given directories
{'fraction_non_alphanumeric': 0.14196516595465003, 'fraction_numerical': 0.0006572461386789353, 'mean_word_length': 3.704791344667697, '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': '2339933', 'n_tokens_mistral': 1065, 'n_tokens_neox': 1003, 'n_words': 273}