# coding: utf-8

from __future__ import division, print_function

__author__ = "adrn <adrn@astro.columbia.edu>"

# Standard library
import os, sys
from distutils.core import setup
from distutils.extension import Extension

# Third-party
import numpy as np
from Cython.Distutils import build_ext

# Get numpy path
numpy_base_path = os.path.split(np.__file__)[0]
numpy_incl_path = os.path.join(numpy_base_path, "core", "include")

cpotential = Extension("streamteam.potential.cpotential",
                       ["streamteam/potential/cpotential.pyx"],
                       include_dirs=[numpy_incl_path])

cbuiltin = Extension("streamteam.potential.cbuiltin",
                     ["streamteam/potential/cbuiltin.pyx"],
                     include_dirs=[numpy_incl_path])

setup(
    name="streamteam",
    version="0.1",
    author="Adrian M. Price-Whelan",
    author_email="adrn@astro.columbia.edu",
    license="BSD",
    cmdclass = {'build_ext': build_ext},
    ext_modules=[cpotential, cbuiltin],
    packages=["streamteam", "streamteam.coordinates", "streamteam.io",
              "streamteam.observation", "streamteam.integrate",
              "streamteam.dynamics", "streamteam.inference",
              "streamteam.potential"],
    scripts=['bin/plotsnap', 'bin/moviesnap', 'bin/snap2gal']
)

@@ -287,16 +287,51 @@
 uild_ext
+%0Afrom Cython.Build import cythonize
 %0A%0A# Get 
@@ -457,17 +457,16 @@
 lude%22)%0A%0A
-c
 potentia
@@ -505,22 +505,12 @@
 ial.
-cpotential
+*
 %22,%0A
- 
     
@@ -554,26 +554,17 @@
 ial/
-cpotential
+*
 .pyx%22%5D,%0A
     
@@ -551,33 +551,32 @@
 ential/*.pyx%22%5D,%0A
- 
                 
@@ -618,174 +618,32 @@
 %5D)%0A%0A
-cbuiltin = Extension(%22streamteam.potential.cbuiltin%22,%0A                     %5B%22streamteam/potential/cbuiltin.pyx%22%5D,%0A                     include_dirs=%5Bnumpy_incl_path%5D)
+extensions = %5Bpotential%5D
 %0A%0Ase
@@ -850,30 +850,29 @@
 les=
-%5Bcpotential, cbuiltin%5D
+cythonize(extensions)
 ,%0A  

use glob to get all pyx