<commit_before>#! /usr/bin/env python
# -*- coding: utf-8 -*-

# Std lib imports
import re
from os.path import join, abspath

# Non-std lib imports
from setuptools import setup, Extension


DESCRIPTION = ("Efficiently perform string to number type "
               "conversion with error handling.")
try:
    with open('README.rst') as fl:
        LONG_DESCRIPTION = fl.read()
except IOError:
    LONG_DESCRIPTION = DESCRIPTION


def current_version():
    '''Get the current version number'''
    VERSIONFILE = join('include', 'version.h')
    with open(VERSIONFILE, "rt") as fl:
        versionstring = fl.read()
    m = re.search(r"#define \w+_VERSION \"(.*)\"", versionstring)
    if m:
        return m.group(1)
    else:
        s = "Unable to locate version string in {0}"
        raise RuntimeError(s.format(VERSIONFILE))


# Create a list of all the source files
sourcefiles = [
    'check_number_is_number.c',
    'check_object_is_number.c',
    'check_string_is_number.c',
    'check_unicode_character_is_number.c',
    'convert_number_to_number.c',
    'convert_object_to_number.c',
    'convert_python_string_to_string.c',
    'convert_python_unicode_to_unicode_character.c',
    'convert_string_to_number.c',
    'convert_unicode_character_to_number.c',
    'parse_integer_from_string.c',
    'parse_float_from_string.c',
    'quick_float_might_overflow.c',
    'string_contains_integer.c',
    'string_contains_intlike_float.c',
    'string_contains_float.c',
    'fastnumbers.c',
]
sourcefiles = [join('src', sf) for sf in sourcefiles]


# Extension definition
ext = Extension('fastnumbers', sourcefiles,
                include_dirs=[abspath(join('include'))],
                extra_compile_args=[])


# Define the build
setup(name='fastnumbers',
      version=current_version(),
      author='<NAME>',
      author_email='<EMAIL>',
      url='https://github.com/SethMMorton/fastnumbers',
      license='MIT',
      ext_modules=[ext],
      description=DESCRIPTION,
      long_description=LONG_DESCRIPTION,
      classifiers=(
        'Development Status :: 5 - Production/Stable',
        'Intended Audience :: Science/Research',
        'Intended Audience :: Developers',
        'Intended Audience :: Information Technology',
        'Intended Audience :: System Administrators',
        'Intended Audience :: Financial and Insurance Industry',
        'Operating System :: OS Independent',
        'License :: OSI Approved :: MIT License',
        'Natural Language :: English',
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.6',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',<commit_msg>setup.py no longer needs an explicit list of source files.<commit_after>#! /usr/bin/env python
# -*- coding: utf-8 -*-

# Std lib imports
import re
import glob
from os.path import join, abspath

# Non-std lib imports
from setuptools import setup, Extension


DESCRIPTION = ("Efficiently perform string to number type "
               "conversion with error handling.")
try:
    with open('README.rst') as fl:
        LONG_DESCRIPTION = fl.read()
except IOError:
    LONG_DESCRIPTION = DESCRIPTION


def current_version():
    '''Get the current version number'''
    VERSIONFILE = join('include', 'version.h')
    with open(VERSIONFILE, "rt") as fl:
        versionstring = fl.read()
    m = re.search(r"#define \w+_VERSION \"(.*)\"", versionstring)
    if m:
        return m.group(1)
    else:
        s = "Unable to locate version string in {0}"
        raise RuntimeError(s.format(VERSIONFILE))


# Extension definition
ext = Extension('fastnumbers', glob.glob('src/*.c'),
                include_dirs=[abspath(join('include'))],
                extra_compile_args=[])


# Define the build
setup(name='fastnumbers',
      version=current_version(),
      author='<NAME>',
      author_email='<EMAIL>',
      url='https://github.com/SethMMorton/fastnumbers',
      license='MIT',
      ext_modules=[ext],
      description=DESCRIPTION,
      long_description=LONG_DESCRIPTION,
      classifiers=(
        'Development Status :: 5 - Production/Stable',
        'Intended Audience :: Science/Research',
        'Intended Audience :: Developers',
        'Intended Audience :: Information Technology',
        'Intended Audience :: System Administrators',
        'Intended Audience :: Financial and Insurance Industry',
        'Operating System :: OS Independent',
        'License :: OSI Approved :: MIT License',
        'Natural Language :: English',
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.6',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
{'fraction_non_alphanumeric': 0.12505263157894736, 'fraction_numerical': 0.004210526315789474, 'mean_word_length': 3.109861591695502, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2286356', 'n_tokens_mistral': 1420, 'n_tokens_neox': 1361, 'n_words': 349}