-
Notifications
You must be signed in to change notification settings - Fork 151
/
setup.py
96 lines (87 loc) · 2.93 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
import os
import platform
from setuptools import setup
# "import" __version__
__version__ = 'unknown'
for line in open('sounddevice.py'):
if line.startswith('__version__'):
exec(line)
break
MACOSX_VERSIONS = '.'.join([
'macosx_10_6_x86_64', # for compatibility with pip < v21
'macosx_10_6_universal2',
])
# environment variables for cross-platform package creation
system = os.environ.get('PYTHON_SOUNDDEVICE_PLATFORM', platform.system())
architecture0 = os.environ.get('PYTHON_SOUNDDEVICE_ARCHITECTURE',
platform.architecture()[0])
if system == 'Darwin':
libname = 'libportaudio.dylib'
elif system == 'Windows':
libname = 'libportaudio' + architecture0 + '.dll'
libname_asio = 'libportaudio' + architecture0 + '-asio.dll'
else:
libname = None
if libname and os.path.isdir('_sounddevice_data/portaudio-binaries'):
packages = ['_sounddevice_data']
package_data = {'_sounddevice_data': ['portaudio-binaries/' + libname,
'portaudio-binaries/README.md']}
if system == 'Windows':
package_data['_sounddevice_data'].append(
'portaudio-binaries/' + libname_asio)
zip_safe = False
else:
packages = None
package_data = None
zip_safe = True
try:
from wheel.bdist_wheel import bdist_wheel
except ImportError:
cmdclass = {}
else:
class bdist_wheel_half_pure(bdist_wheel):
"""Create OS-dependent, but Python-independent wheels."""
def get_tag(self):
if system == 'Darwin':
oses = MACOSX_VERSIONS
elif system == 'Windows':
if architecture0 == '32bit':
oses = 'win32'
else:
oses = 'win_amd64'
else:
oses = 'any'
return 'py3', 'none', oses
cmdclass = {'bdist_wheel': bdist_wheel_half_pure}
setup(
name='sounddevice',
version=__version__,
py_modules=['sounddevice'],
packages=packages,
package_data=package_data,
zip_safe=zip_safe,
python_requires='>=3.7',
setup_requires=['CFFI>=1.0'],
install_requires=['CFFI>=1.0'],
extras_require={'NumPy': ['NumPy']},
cffi_modules=['sounddevice_build.py:ffibuilder'],
author='Matthias Geier',
author_email='[email protected]',
description='Play and Record Sound with Python',
long_description=open('README.rst').read(),
license='MIT',
keywords='sound audio PortAudio play record playrec'.split(),
url='http://python-sounddevice.readthedocs.io/',
project_urls={
'Source': 'https://github.com/spatialaudio/python-sounddevice',
},
platforms='any',
classifiers=[
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Topic :: Multimedia :: Sound/Audio',
],
cmdclass=cmdclass,
)