<commit_before>import platform
from setuptools import setup, find_packages

install_requires = [
    'PIL>=1.1.6,<1.2.99',
    'PyYAML>=3.0,<3.99',
]

if platform.python_version_tuple() < ('2', '6'):
    # for mapproxy-seed
    install_requires.append('multiprocessing>=2.6')

def long_description(changelog_releases=10):
    import re
    import textwrap

    readme = open('README.rst').read()
    changes = ['Changes\n-------\n']
    version_line_re = re.compile('^\d\.\d+\.\d+\S*\s20\d\d-\d\d-\d\d')
    for line in open('CHANGES.txt'):
        if version_line_re.match(line):
            if changelog_releases == 0:
                break
            changelog_releases -= 1
        changes.append(line)
    
    changes.append(textwrap.dedent('''
        Older changes
        -------------
        See https://bitbucket.org/olt/mapproxy/src/default/CHANGES.txt
        '''))
    return readme + ''.join(changes)

setup(
    name='MapProxy',
    version="1.6.0a",
    description='An accelerating proxy for web map services',
    long_description=long_description(7),
    author='<NAME>',
    author_email='<EMAIL>',
    url='http://mapproxy.org',
    license='Apache Software License 2.0',
    namespace_packages = ['mapproxy'],
    packages=find_packages(),
    include_package_data=True,
    entry_points = {
        'console_scripts': [
            'mapproxy-seed = mapproxy.seed.script:main',
            'mapproxy-util = mapproxy.script.util:main',<commit_msg>depend on Pillow if present, otherwise on PIL<commit_after>import platform
from setuptools import setup, find_packages
import pkg_resources


install_requires = [
    'PyYAML>=3.0,<3.99',
]

def pillow_installed():
    """Check if Pillow is installed"""
    pillow_req = pkg_resources.Requirement.parse('Pillow')
    try:
        pkg_resources.get_provider(pillow_req)
    except pkg_resources.DistributionNotFound:
        return False
    else:
        return True

# depend in Pillow if it is installed, otherwise depend on PIL
if pillow_installed():
    install_requires.append('Pillow')
else:
    install_requires.append('PIL>=1.1.6,<1.2.99')

if platform.python_version_tuple() < ('2', '6'):
    # for mapproxy-seed
    install_requires.append('multiprocessing>=2.6')

def long_description(changelog_releases=10):
    import re
    import textwrap

    readme = open('README.rst').read()
    changes = ['Changes\n-------\n']
    version_line_re = re.compile('^\d\.\d+\.\d+\S*\s20\d\d-\d\d-\d\d')
    for line in open('CHANGES.txt'):
        if version_line_re.match(line):
            if changelog_releases == 0:
                break
            changelog_releases -= 1
        changes.append(line)

    changes.append(textwrap.dedent('''
        Older changes
        -------------
        See https://bitbucket.org/olt/mapproxy/src/default/CHANGES.txt
        '''))
    return readme + ''.join(changes)

setup(
    name='MapProxy',
    version="1.6.0a",
    description='An accelerating proxy for web map services',
    long_description=long_description(7),
    author='<NAME>',
    author_email='<EMAIL>',
    url='http://mapproxy.org',
    license='Apache Software License 2.0',
    namespace_packages = ['mapproxy'],
    packages=find_packages(),
    include_package_data=True,
    entry_points = {
        'console_scripts': [
            'mapproxy-seed = mapproxy.seed.script:main',
            'mapproxy-util = mapproxy.script.util:main',
{'fraction_non_alphanumeric': 0.1509929906542056, 'fraction_numerical': 0.016355140186915886, 'mean_word_length': 2.7971175166297115, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 2, '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': '5114516', 'n_tokens_mistral': 1147, 'n_tokens_neox': 1116, 'n_words': 197}