<commit_before>"""
Example package for bundling a C dependency as a Python Extension
if it is not found.

This example is a Cython project, but it doesn't need to be.
"""

from __future__ import print_function

import glob
import os
import sys
pjoin = os.path.join

from distutils.core import setup
from distutils.extension import Extension

# if not using Cython, get build_ext from distutils
# from distutils.command.build_ext import build_ext
from Cython.Distutils import build_ext

def line():
    print('-' * 60)

class DetectBundled(build_ext):
    description = "Locate libbundled, and bundle it as an extension if we can't find it"
    
    already_run = False
    
    def build_extensions(self):
        """we don't actually want to do any compilation"""
        return
    
    def run(self):
        if self.already_run:
            # don't run more than once
            return
        # build_ext.run configures the compiler and calls self.build_extensions (no-op)
        build_ext.run(self)
        
        # check if we can link a simple program against libbundled
        cc = self.compiler
        line()
        print("Checking for libbundled")
        if cc.has_function("bundled_version", libraries=["bundled"]):
            print("Found libbundled")<commit_msg>check for libbundled in build_temp<commit_after>"""
Example package for bundling a C dependency as a Python Extension
if it is not found.

This example is a Cython project, but it doesn't need to be.
"""

from __future__ import print_function

import glob
import os
import sys
pjoin = os.path.join

from distutils.core import setup
from distutils.extension import Extension

# if not using Cython, get build_ext from distutils
# from distutils.command.build_ext import build_ext
from Cython.Distutils import build_ext

def line():
    print('-' * 60)

class DetectBundled(build_ext):
    description = "Locate libbundled, and bundle it as an extension if we can't find it"
    
    already_run = False
    
    def build_extensions(self):
        """we don't actually want to do any compilation"""
        return
    
    def run(self):
        if self.already_run:
            # don't run more than once
            return
        # build_ext.run configures the compiler and calls self.build_extensions (no-op)
        build_ext.run(self)
        
        # check if we can link a simple program against libbundled
        cc = self.compiler
        line()
        print("Checking for libbundled")
        cc.output_dir = self.build_temp
        if cc.has_function("bundled_version", libraries=["bundled"]):
            print("Found libbundled")
{'fraction_non_alphanumeric': 0.07183580387685291, 'fraction_numerical': 0.0015203344735841885, 'mean_word_length': 2.8592375366568916, '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': '387139', 'n_tokens_mistral': 748, 'n_tokens_neox': 731, 'n_words': 281}