#!/usr/bin/env python
# coding: utf-8

from distribute_setup import use_setuptools
use_setuptools()

import sys
import os

if (len(sys.argv) > 1 and sys.argv[1] == 'test'):
  print("""
  Running tests against installed mockito...
  """)
  
  import shutil
  shutil.rmtree('build_test', True)
  shutil.copytree('mockito_test', 'build_test/mockito_test')
  
  sys.path[0] = os.path.join(sys.path[0], 'build_test', 'mockito_test')
  os.chdir(os.path.join('build_test', 'mockito_test'))
  
  import mockito_importer
  mockito_importer.imp = lambda : "don't really import anything..."
  
  import smart_test_runner
  smart_test_runner.run()
  
  exit(0)

if (len(sys.argv) == 1):
  print ("""
  1. Non-standard usage (not listed by --help):
    
    'setup.py test' runs tests against installed Mockito.
    You can use it to verify the installation: 
  
    setup.py test
    
  2. Standard usage:
  """)

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

extra = {}
if sys.version_info >= (3,):
  extra['use_2to3'] = True

setup(name='mockito',
      version='0.2.0',
      packages=['mockito'],
      url='http://code.google.com/p/mockito/wiki/MockitoForPython',
      download_url='http://bitbucket.org/szczepiq/mockito-python/downloads/',
      maintainer='mockito maintainers',
      maintainer_email='mockito-python@googlegroups.com',
      license='MIT',
      description='Spying framework',
      long_description='Mockito is a spying framework based on Java library with the same name.',
      classifiers=['Development Status :: 4 - Beta',
                   'Intended Audience :: Developers',
                   'License :: OSI Approved :: MIT License',
                   'Topic :: Software Development :: Testing'
                  ],
      **extra
)


@@ -98,809 +98,8 @@
 ()%0A%0A
-import sys%0Aimport os%0A%0Aif (len(sys.argv) %3E 1 and sys.argv%5B1%5D == 'test'):%0A  print(%22%22%22%0A  Running tests against installed mockito...%0A  %22%22%22)%0A  %0A  import shutil%0A  shutil.rmtree('build_test', True)%0A  shutil.copytree('mockito_test', 'build_test/mockito_test')%0A  %0A  sys.path%5B0%5D = os.path.join(sys.path%5B0%5D, 'build_test', 'mockito_test')%0A  os.chdir(os.path.join('build_test', 'mockito_test'))%0A  %0A  import mockito_importer%0A  mockito_importer.imp = lambda : %22don't really import anything...%22%0A  %0A  import smart_test_runner%0A  smart_test_runner.run()%0A  %0A  exit(0)%0A%0Aif (len(sys.argv) == 1):%0A  print (%22%22%22%0A  1. Non-standard usage (not listed by --help):%0A    %0A    'setup.py test' runs tests against installed Mockito.%0A    You can use it to verify the installation: %0A  %0A    setup.py test%0A    %0A  2. Standard usage:%0A  %22%22%22)%0A%0A
 try:

Remove custom unit tests running from setup file. Runnig via distutils will follow.