<commit_before>#!/usr/bin/env python
#
# $Id$

import distutils.core
import glob
import os
import sys
import warnings

LIBEVENT_BUILD_DIR = '../libevent*'

def get_best_build_dir():
    candidates = reversed(glob.glob(LIBEVENT_BUILD_DIR))
    matches = (dir for dir in candidates if os.path.isdir(dir))
    try:
        best = next(matches)
        print 'found libevent build directory', ev_dir
    except StopIteration:
        warnings.warn("Could not find libevent")
        best = '../libevent'
    return best

def get_extension():
    event = distutils.core.Extension(name='event', sources=['event.c'])
    if glob.glob('/usr/lib/libevent.*'):
        print 'found system libevent for', sys.platform
        event.libraries=['event']
        return event
    elif glob.glob('%s/lib/libevent.*' % sys.prefix):
        print 'found installed libevent in', sys.prefix
        event.include_dirs=['%s/include' % sys.prefix]
        event.library_dirs=['%s/lib' % sys.prefix]
        event.libraries=['event']
        return event

    ev_dir = get_best_build_dir()
    event.include_dirs.append(ev_dir)

    if sys.platform == 'win32':
        event.include_dirs.extend([
            '%(ev_dir)s/WIN32-Code' % vars(),
            '%(ev_dir)s/compat' % vars()
        ])
        sources = ['WIN32-Code/misc.c', 'WIN32-Code/win32.c', 'log.c', 'event.c']
        sources = [os.path.join(ev_dir, source) for source in sources]
        event.sources.extend(sources)
        event.extra_compile_args.extend(['-DWIN32', '-DHAVE_CONFIG_H'])
        event.libraries.append('wsock32')
    else:
        event.extra_objects.extend(glob.glob('%(ev_dir)s/*.o' % vars()))

    return event

setup_params = dict(
    name='event',
    version='0.4',
    author='<NAME>',
    author_email='<EMAIL>',
    url='http://monkey.org/~dugsong/pyevent/',
    description='event library',
    long_description="""This module provides a mechanism to execute a function when a specific event on a file handle, file descriptor, or signal occurs, or after a given time has passed.""",
    license='BSD',
    download_url='http://monkey.org/~dugsong/pyevent/',
    ext_modules = [get_extension()],
)

if __name__ == '__main__':
    distutils.core.setup(**setup_params)
<commit_msg>Set build to 0.4b1 in preparation for a tagged release<commit_after>#!/usr/bin/env python
#
# $Id$

import distutils.core
import glob
import os
import sys
import warnings

LIBEVENT_BUILD_DIR = '../libevent*'

def get_best_build_dir():
    candidates = reversed(glob.glob(LIBEVENT_BUILD_DIR))
    matches = (dir for dir in candidates if os.path.isdir(dir))
    try:
        best = next(matches)
        print 'found libevent build directory', ev_dir
    except StopIteration:
        warnings.warn("Could not find libevent")
        best = '../libevent'
    return best

def get_extension():
    event = distutils.core.Extension(name='event', sources=['event.c'])
    if glob.glob('/usr/lib/libevent.*'):
        print 'found system libevent for', sys.platform
        event.libraries=['event']
        return event
    elif glob.glob('%s/lib/libevent.*' % sys.prefix):
        print 'found installed libevent in', sys.prefix
        event.include_dirs=['%s/include' % sys.prefix]
        event.library_dirs=['%s/lib' % sys.prefix]
        event.libraries=['event']
        return event

    ev_dir = get_best_build_dir()
    event.include_dirs.append(ev_dir)

    if sys.platform == 'win32':
        event.include_dirs.extend([
            '%(ev_dir)s/WIN32-Code' % vars(),
            '%(ev_dir)s/compat' % vars()
        ])
        sources = ['WIN32-Code/misc.c', 'WIN32-Code/win32.c', 'log.c', 'event.c']
        sources = [os.path.join(ev_dir, source) for source in sources]
        event.sources.extend(sources)
        event.extra_compile_args.extend(['-DWIN32', '-DHAVE_CONFIG_H'])
        event.libraries.append('wsock32')
    else:
        event.extra_objects.extend(glob.glob('%(ev_dir)s/*.o' % vars()))

    return event

setup_params = dict(
    name='event',
    version='0.4b1',
    author='<NAME>',
    author_email='<EMAIL>',
    url='https://bitbucket.org/jaraco/pyevent',
    description='event library',
    long_description="""This module provides a mechanism to execute a function when a specific event on a file handle, file descriptor, or signal occurs, or after a given time has passed.""",
    license='BSD',
    ext_modules = [get_extension()],
)

if __name__ == '__main__':
    distutils.core.setup(**setup_params)

{'fraction_non_alphanumeric': 0.14524021352313168, 'fraction_numerical': 0.00800711743772242, 'mean_word_length': 3.0770625566636447, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3881709', 'n_tokens_mistral': 1471, 'n_tokens_neox': 1438, 'n_words': 320}