1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
#! /usr/bin/python
from distutils.core import setup, Extension, Command
import sys
import unittest
class TestCommand(Command):
description = "Run test suite"
user_options = []
def initialize_options(self):
self.build_dir = None
def finalize_options(self):
self.set_undefined_options('install', ('build_lib', 'build_dir'))
def run(self):
self.announce("running tests")
old_path = sys.path[:]
try:
sys.path.insert(0, self.build_dir)
from py_kdtree_test import suite
res = unittest.TextTestRunner().run(suite())
if not res.wasSuccessful():
sys.exit(1)
finally:
# Restore sys.path
sys.path[:] = old_path
setup(
name='kdtree',
version='0.7.1',
author='kdtree authors',
description='kd-tree',
ext_modules=[
Extension('_kdtree',
sources=['py-kdtree.i'],
swig_opts=['-modern', '-c++'],
include_dirs=['..'])],
py_modules=['kdtree'],
cmdclass={
'test': TestCommand
}
)
|