#!python

from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext

import os
import numpy
Include_dirs = [ '.', 'lib', numpy.get_include()]
Ldirs = os.environ.get('LD_LIBRARY_PATH', '').split(':')
# Ldirs = [ os.path.join(os.environ['HOME'], 'local', 'lib') ]
for l in Ldirs:
	if l.endswith('/lib'):
		Include_dirs.append( '/'.join(l.split('/')[:-1] + ['include']) )
del l

setup(name="gpk-voicing", version = "1.13.1",
	description = "Python Libraries and scripts for speech analysis.",
	author = "Greg Kochanski",
	url = "http://kochanski.org/gpk/code/speechresearch/voicing",
	author_email = "gpk@kochanski.org",
	packages = ['gpk_voicing'],
	package_dir = {'gpk_voicing': 'lib'},
	scripts = ['emphasis_stevens.py', 'feature_vec.py', 'pseudoduration.py',
			'irregularity.py', 'g_audioprep.py', 'xform_feature_vec.py',
			'audio_cat_normalize.py'
			],
	ext_modules=[ 
    		Extension("gpk_voicing.power1",         ["lib/power1.pyx"],
				include_dirs = Include_dirs,
				depends = [],
				library_dirs = Ldirs,
				libraries = ['gpk'],
				language = 'c++'
				),
    		Extension("gpk_voicing.gammatone",         ["lib/gammatone.pyx"],
				include_dirs = Include_dirs,
				depends = [],
				library_dirs = Ldirs,
				libraries = ['gpk'],
				language = 'c++'
				),
    		Extension("gpk_voicing.percep_spec_extras",         ["lib/percep_spec_extras.pyx"],
				include_dirs = Include_dirs,
				depends = [],
				library_dirs = Ldirs,
				libraries = ['gpk'],
				language = 'c++'
				),
    		Extension("gpk_voicing.power1",         ["lib/power1.pyx"],
				include_dirs = Include_dirs,
				depends = [],
				library_dirs = Ldirs,
				libraries = ['gpk'],
				language = 'c++'
				),
		],
	cmdclass = {'build_ext': build_ext},
	license = 'GPL2',
	keywords = ("phonetics speech computation linguistics scripts library python "
			+ "science perception feature vector loudness spectral slope"),
	platforms = "All",
	classifiers = [
		'License :: OSI Approved :: GNU General Public License (GPL)',
		'Operating System :: OS Independent',
		'Development Status :: 3 - Alpha',
		'Topic :: Scientific/Engineering',
		'Environment :: Console',
		'Intended Audience :: Science/Research',
		'Programming Language :: Python',
		'Operating System :: OS Independent',
		'Programming Language :: Python',
		],
	long_description = """Python Libraries for speech analysis.
	See http://kochanski.plus.com/code/speechresearch/voicing for documentation
	and http://sourceforge.net/projects/speechresearch for downloads,
	or look on the Python Cheese shop, http://pypi.python.org .
	"""
	)

