#! /usr/bin/python

import versioneer
from distutils.core import setup
from os import mkdir, path
from setuptools.command.test import test as TestCommand
from subprocess import Popen, PIPE
import shutil
import sys




class PyTest(TestCommand):

    """Integration of PyTest with setuptools."""

    user_options = [('pytest-args=', 'a', 'Arguments to pass to py.test')]

    def initialize_options(self):
        """Initialize options."""
        TestCommand.initialize_options(self)
        try:
            from ConfigParser import ConfigParser
        except ImportError:
            from configparser import ConfigParser
        config = ConfigParser()
        config.read("pytest.ini")
        self.pytest_args = config.get("pytest", "addopts").split(" ")

    def finalize_options(self):
        """Finalize options."""
        TestCommand.finalize_options(self)
        self.test_args = []
        self.test_suite = True

    def run_tests(self):
        """Run tests."""
        # import here, cause outside the eggs aren't loaded
        import pytest
        shutil.rmtree('tests/tmp', ignore_errors=True)
        mkdir('tests/tmp')
        errno = pytest.main(self.pytest_args)
        shutil.rmtree('tests/tmp', ignore_errors=True)
        sys.exit(errno)

with open(path.join(path.dirname(__file__), 'README.rst')) as long_d_f:
    long_description = long_d_f.read()

setup(name='qarnot',
      version=versioneer.get_version(),
      cmdclass=versioneer.get_cmdclass(),
      description= 'Qarnot Computing SDK',
      long_description= long_description,
      author='Qarnot computing',
      author_email='support@qarnot-computing.com',
      url='https://computing.qarnot.com',
      packages=['qarnot'],
      install_requires=['requests'],
      classifiers=['Development Status :: 5 - Production/Stable',
                   'Intended Audience :: Developers',
                   'Intended Audience :: Information Technology',
                   'License :: OSI Approved :: Apache Software License'],
      license='apache')

@@ -16,26 +16,31 @@
 hon%0A
-%0Aimport versioneer
+%22%22%22Setuptools file.%22%22%22%0A
 %0Afro
@@ -88,1190 +88,30 @@
 ort 
-mkdir, path%0Afrom setuptools.command.test import test as TestCommand%0Afrom subprocess import Popen, PIPE%0Aimport shutil%0Aimport sys%0A%0A%0A%0A%0Aclass PyTest(TestCommand):%0A%0A    %22%22%22Integration of PyTest with setuptools.%22%22%22%0A%0A    user_options = %5B('pytest-args=', 'a', 'Arguments to pass to py.test')%5D%0A%0A    def initialize_options(self):%0A        %22%22%22Initialize options.%22%22%22%0A        TestCommand.initialize_options(self)%0A        try:%0A            from ConfigParser import ConfigParser%0A        except ImportError:%0A            from configparser import ConfigParser%0A        config = ConfigParser()%0A        config.read(%22pytest.ini%22)%0A        self.pytest_args = config.get(%22pytest%22, %22addopts%22).split(%22 %22)%0A%0A    def finalize_options(self):%0A        %22%22%22Finalize options.%22%22%22%0A        TestCommand.finalize_options(self)%0A        self.test_args = %5B%5D%0A        self.test_suite = True%0A%0A    def run_tests(self):%0A        %22%22%22Run tests.%22%22%22%0A        # import here, cause outside the eggs aren't loaded%0A        import pytest%0A        shutil.rmtree('tests/tmp', ignore_errors=True)%0A        mkdir('tests/tmp')%0A        errno = pytest.main(self.pytest_args)%0A        shutil.rmtree('tests/tmp', ignore_errors=True)%0A        sys.exit(errno)
+path%0Aimport versioneer
 %0A%0Awi
@@ -184,32 +184,32 @@
 _f:%0A    
-long_description
+LONG_DESCRIPTION
  = long_
@@ -341,17 +341,16 @@
 ription=
- 
 'Qarnot 
@@ -388,33 +388,32 @@
 ription=
- long_description
+LONG_DESCRIPTION
 ,%0A      

Clean setup.py