import pkg_resources
import setuptools
import os


def read_file(file_name):
    """Utility function to read a file."""
    return open(os.path.join(os.path.dirname(__file__), file_name)).read()


def read_first_line(file_name):
    """Read the first line from the specified file."""
    with open(os.path.join(os.path.dirname(__file__), file_name)) as f:
        return f.readline().strip()


def read_requirements(file_path):
    return [
        i.strip()
        for i in pkg_resources.resource_string(__name__, 'requirements.txt').split()
        if i.strip()[0:1] != '#' and i.strip()[0:2] != '--' and len(i.strip()) > 0
    ]


REQUIREMENTS = read_requirements('requirements.txt')
TEST_REQUIREMENTS = read_requirements('requirements-dev.txt')


setuptools.setup(name='PyLCP',
                 version=read_first_line('version_number.txt'),
                 description="Python client library for Points Loyalty Commerce Platform.",
                 long_description=read_file('README.txt'),
                 classifiers=[
                      'Development Status :: 3 - Alpha',
                      'Environment :: Web Environment',
                      'Intended Audience :: Developers',
                      'License :: Other/Proprietary License',
                      'Natural Language :: English',
                      'Operating System :: POSIX :: Linux',
                      'Programming Language :: Python',
                      'Programming Language :: Python :: 2.7',
                      'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
                      'Topic :: Software Development :: Libraries :: Python Modules'
                 ],
                 keywords='LCP REST',
                 author='Points International',
                 author_email='',
                 url='',
                 license='',
                 packages=[
                     'pylcp'
                 ],
                 include_package_data=True,
                 zip_safe=False,
                 install_requires=REQUIREMENTS,
                 entry_points="""
                 # -*- Entry points: -*-
                 """,
                 test_suite='nose.collector',
                 tests_require=TEST_REQUIREMENTS
                 )

@@ -1,12 +1,171 @@
+# Necessary to supress on error at the completion of python setup.py test.%0A# See http://bugs.python.org/issue15881#msg170215%0Aimport multiprocessing%0A%0Aimport os%0A
 import pkg_r
@@ -193,18 +193,8 @@
 tool
-s%0Aimport o
 s%0A%0A%0A

Fix error at end of test run.