-
Notifications
You must be signed in to change notification settings - Fork 26
/
setup.py
107 lines (92 loc) · 3.58 KB
/
setup.py
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/usr/bin/env python
# encoding: utf-8
# cython: embedsignature=True
from __future__ import print_function
from setuptools import setup, find_packages
from sys import version_info as python_version
import os
from distutils.extension import Extension
from Cython.Distutils import build_ext
from os import environ
from sys import stderr
from sys import platform
curr_dir = os.path.dirname(__file__)
install_requires = ['cython>=0.21', 'pystache>=0.5', 'pyyaml>=3.11']
if python_version < (2, 7):
new_27 = ['ordereddict', 'argparse']
install_requires.extend(new_27)
kaldi_dir = environ.get('KALDI_DIR', 'libs/kaldi')
library_dirs = ['/usr/lib']
libraries = ['lapack_atlas', 'cblas', 'atlas', 'f77blas', 'm', 'pthread', 'dl']
def kaldi_path(path):
return os.path.join(kaldi_dir, path)
class build_ext_with_make(build_ext):
def run(self):
os.system('(cd "%s"; bash prepare_env.sh; make)' % curr_dir)
with open('setup.py.add_libs') as f_in:
libs = f_in.read().split()
for ext in self.extensions:
ext.extra_objects.extend(libs)
with open('setup.py.cxxflags_kaldi') as f_in:
flags = f_in.read().split()
for ext in self.extensions:
if ext.name =='alex_asr.decoder':
ext.extra_compile_args.extend(flags)
with open('setup.py.cxxflags_pyfst') as f_in:
flags = f_in.read().split()
for ext in self.extensions:
if ext.name =='alex_asr.fst._fst':
ext.extra_compile_args.extend(flags)
build_ext.run(self)
setup(
name='alex_asr',
packages=find_packages(exclude=["alex_asr/decoder.cpp"]),
include_package_data=True,
cmdclass={'build_ext': build_ext_with_make},
version='1.0.4',
install_requires=install_requires,
setup_requires=['cython>=0.19.1', 'nose>=1.0'],
ext_modules=[
Extension('alex_asr.decoder',
language='c++',
include_dirs=[
'.',
kaldi_path('tools/openfst/include'),
kaldi_path('src'),
],
library_dirs=library_dirs,
libraries=libraries,
sources=['alex_asr/decoder.pyx', ],
),
Extension(name='alex_asr.fst._fst',
extra_compile_args=['-std=c++0x'], # NOTE: This is for backward compatibility with gcc 4.6 which is in ubuntu 12.04. Ideally we should use '-std=c++11'.
include_dirs=[
'.',
kaldi_path('tools/openfst/include'),
kaldi_path('src'),
],
sources=['alex_asr/fst/_fst.pyx'],
language='c++'
)
],
author='Charles University in Prague (Lukas Zilka)',
author_email='[email protected]',
url='https://github.com/UFAL-DSG/alex-asr',
license='Apache Software License 2.0',
keywords='asr, speech recognition, decoder, speech',
description='Incremental speech recognition decoder for Kaldi NNET2 and GMM models.',
download_url='https://github.com/UFAL-DSG/alex-asr/archive/v1.0.4.tar.gz',
long_description='',
classifiers='''
Programming Language :: Python :: 2
Programming Language :: Python :: 3
License :: OSI Approved :: Apache Software License
Operating System :: POSIX :: Linux
Topic :: Multimedia :: Sound/Audio :: Speech
Topic :: Scientific/Engineering
Intended Audience :: Developers
Intended Audience :: Science/Research
Intended Audience :: Telecommunications Industry
Environment :: Console
'''.strip().splitlines(),
)