-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathsetup.py
executable file
·75 lines (63 loc) · 2.25 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
#!/usr/bin/python
"""A setuptools-based script for distributing and installing mcd."""
# Copyright 2014, 2015, 2016, 2017 Matt Shannon
# This file is part of mcd.
# See `License` for details of license and warranty.
import os
import numpy as np
from setuptools import setup
from setuptools.extension import Extension
from setuptools.command.sdist import sdist as _sdist
cython_locs = [
('mcd', 'metrics_fast'),
]
with open('README.rst') as readme_file:
long_description = readme_file.read()
requires = [ line.rstrip('\n') for line in open('requirements.txt') ]
# see "A note on setup.py" in README.rst for an explanation of the dev file
dev_mode = os.path.exists('dev')
if dev_mode:
from Cython.Distutils import build_ext
from Cython.Build import cythonize
class sdist(_sdist):
"""A cythonizing sdist command.
This class is a custom sdist command which ensures all cython-generated
C files are up-to-date before running the conventional sdist command.
"""
def run(self):
cythonize([ os.path.join(*loc)+'.pyx' for loc in cython_locs ])
_sdist.run(self)
cmdclass = {'build_ext': build_ext, 'sdist': sdist}
ext_modules = [
Extension('.'.join(loc), [os.path.join(*loc)+'.pyx'],
extra_compile_args=['-Wno-unused-but-set-variable', '-O3'],
include_dirs=[np.get_include()])
for loc in cython_locs
]
else:
cmdclass = {}
ext_modules = [
Extension('.'.join(loc), [os.path.join(*loc)+'.c'],
extra_compile_args=['-Wno-unused-but-set-variable', '-O3'],
include_dirs=[np.get_include()])
for loc in cython_locs
]
setup(
name='mcd',
version='0.5.dev1',
description='Mel cepstral distortion (MCD) computations in python.',
url='http://github.com/MattShannon/mcd',
author='Matt Shannon',
author_email='[email protected]',
license='3-clause BSD (see License file)',
packages=['mcd'],
install_requires=requires,
scripts=[
os.path.join('bin', 'dtw_synth'),
os.path.join('bin', 'get_mcd_dtw'),
os.path.join('bin', 'get_mcd_plain'),
],
long_description=long_description,
cmdclass=cmdclass,
ext_modules=ext_modules,
)