Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Investigate using CFFI's API mode #91

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

1 change: 0 additions & 1 deletion _sounddevice_data
Submodule _sounddevice_data deleted from bab7ef
72 changes: 10 additions & 62 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,77 +1,26 @@
import os
import platform
from setuptools import setup

__version__ = 'unknown'

# "import" __version__
for line in open('sounddevice.py'):
for line in open('src/sounddevice.py'):
if line.startswith('__version__'):
exec(line)
break

PYTHON_INTERPRETERS = '.'.join([
'cp26', 'cp27',
'cp32', 'cp33', 'cp34', 'cp35', 'cp36',
'pp27',
'pp32', 'pp33', 'pp34', 'pp35', 'pp36',
])
MACOSX_VERSIONS = '.'.join([
'macosx_10_6_x86_64',
])

# 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'
else:
libname = None

if libname and os.path.isdir('_sounddevice_data'):
packages = ['_sounddevice_data']
package_data = {'_sounddevice_data': [libname, 'README.md']}
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):
pythons = 'py2.py3.' + PYTHON_INTERPRETERS
if system == 'Darwin':
oses = MACOSX_VERSIONS
elif system == 'Windows':
if architecture0 == '32bit':
oses = 'win32'
else:
oses = 'win_amd64'
else:
pythons = 'py2.py3'
oses = 'any'
return pythons, 'none', oses

cmdclass = {'bdist_wheel': bdist_wheel_half_pure}

setup(
name='sounddevice',
version=__version__,
package_dir={'': 'src'},
py_modules=['sounddevice'],
packages=packages,
package_data=package_data,
zip_safe=zip_safe,
install_requires=['CFFI>=1.0'],
cffi_modules=['sounddevice_build.py:ffibuilder'],
setup_requires=[
'CFFI>=1.4.0',
],
install_requires=[
'CFFI>=1', # for _cffi_backend
],
zip_safe=True,
extras_require={'NumPy': ['NumPy']},
author='Matthias Geier',
author_email='[email protected]',
Expand All @@ -89,5 +38,4 @@ def get_tag(self):
'Programming Language :: Python :: 3',
'Topic :: Multimedia :: Sound/Audio',
],
cmdclass=cmdclass,
)
Loading