
try:
    from setuptools import setup
except ImportError:
    from distutils.core import setup

setup(
    name='itunes-iap',
    version=__import__('itunesiap').__version__,
    description='Itunes In-app purchase validation api.',
    long_description=open('README.md').read(),
    author='Jeong YunWon',
    author_email='itunesiap@youknowone.org',
    url='https://github.com/youknowone/itunes-iap',
    packages=(
        'itunesiap',
    ),
    install_requires=[
        'requests',
    ],
)

from __future__ import with_statement

try:
    from setuptools import setup
except ImportError:
    from distutils.core import setup


def get_readme():
    try:
        with open('README.md') as f:
            return f.read().strip()
    except IOError:
        return ''


setup(
    name='itunes-iap',
    version=__import__('itunesiap').__version__,
    description='Itunes In-app purchase validation api.',
    long_description=get_readme(),
    author='Jeong YunWon',
    author_email='itunesiap@youknowone.org',
    url='https://github.com/youknowone/itunes-iap',
    packages=(
        'itunesiap',
    ),
    install_requires=[
        'requests',
    ],
)

Use with statement for reading readme file
Use with statement for reading readme file

1. Without file closing it may cause "too many files" error
   on PyPy.  It's complicated to explain, but related to difference
   of memory handling from CPython (reference counting) to
   PyPy (garbage collection).

2. README.md could be missed from distribution.  For this
   now it returns empty string when it faces to IOError.
