forked from LCAV/pyroomacoustics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
126 lines (100 loc) · 4.15 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/usr/bin/env python
from __future__ import print_function
import numpy
# import version from file
with open('pyroomacoustics/version.py') as f:
exec(f.read())
try:
from setuptools import setup
from setuptools import Extension
except ImportError:
print("Setuptools unavailable. Falling back to distutils.")
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
# To use a consistent encoding
from codecs import open
from os import path
# build C extension for image source model
src_dir = 'pyroomacoustics/c_package'
files = ['libroom.c', 'wall.c', 'linalg.c', 'room.c', 'is_list.c', 'shoebox.c']
libroom_ext = Extension('pyroomacoustics.c_package.libroom',
extra_compile_args = ['-Wall', '-O3', '-std=c99'],
sources = [src_dir + '/' + f for f in files],
include_dirs=[src_dir,numpy.get_include()])
cython_ext = Extension("pyroomacoustics.build_rir", ["pyroomacoustics/build_rir.pyx"])
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup_kwargs = dict(
name='pyroomacoustics',
version=__version__,
description='A simple framework for room acoustics and audio processing in Python.',
long_description=long_description,
author='Laboratory for Audiovisual Communications, EPFL',
author_email='[email protected]',
url='https://github.com/LCAV/pyroomacoustics',
license='MIT',
# You can just specify the packages manually here if your project is
# simple. Or you can use find_packages().
packages=[
'pyroomacoustics',
'pyroomacoustics.c_package',
'pyroomacoustics.doa',
'pyroomacoustics.adaptive',
'pyroomacoustics.transform',
'pyroomacoustics.experimental',
'pyroomacoustics.datasets',
'pyroomacoustics.bss',
'pyroomacoustics.denoise',
],
# Libroom C extension
ext_modules=[libroom_ext] + cythonize(cython_ext),
# Necessary to keep the source files
package_data={
'pyroomacoustics': ['*.pxd', '*.pyx'],
},
install_requires=[
'Cython',
'numpy',
'scipy>=0.18.0',
],
test_suite='nose.collector',
tests_require=['nose'],
classifiers=[
# How mature is this project? Common values are
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
'Development Status :: 4 - Beta',
# Indicate who your project is intended for
'Intended Audience :: Science/Research',
'Intended Audience :: Information Technology',
'Topic :: Scientific/Engineering :: Information Analysis',
'Topic :: Scientific/Engineering :: Physics',
'Topic :: Multimedia :: Sound/Audio :: Speech',
'Topic :: Multimedia :: Sound/Audio :: Analysis',
# Pick your license as you wish (should match "license" above)
'License :: OSI Approved :: MIT License',
# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
#'Programming Language :: Python :: 3.3',
#'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
],
# What does your project relate to?
keywords='room acoustics signal processing doa beamforming adaptive',
)
try:
# Try to build everything first
setup(**setup_kwargs)
except:
# Retry without the C module
print("Error. Probably building C extension failed. Installing pure python.")
setup_kwargs.pop('ext_modules')
setup_kwargs['ext_modules'] = cythonize(cython_ext)
setup(**setup_kwargs)