diff options
| author | Matthias Geier <Matthias.Geier@gmail.com> | 2015-07-01 17:12:27 +0200 |
|---|---|---|
| committer | Matthias Geier <Matthias.Geier@gmail.com> | 2015-07-01 17:27:07 +0200 |
| commit | 1689a1642e054750d9e17574eb012f242f0991c0 (patch) | |
| tree | 8a309cf67a37cab47ee17ec8ed339a800d2158c4 /setup.py | |
| parent | 0529a60f464801f27817817b68410e5cd1e088f6 (diff) | |
Add submodule with binaries and adapt setup procedure
Diffstat (limited to 'setup.py')
| -rw-r--r-- | setup.py | 57 |
1 files changed, 57 insertions, 0 deletions
@@ -1,3 +1,5 @@ +import os +import platform from setuptools import setup __version__ = "unknown" @@ -8,10 +10,64 @@ for line in open("sounddevice.py"): exec(line) break +PYTHON_INTERPRETERS = '.'.join([ + 'cp26', 'cp27', + 'cp32', 'cp33', 'cp34', 'cp35', + 'pp27', + 'pp32', +]) +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: + packages = ['_sounddevice_data'] + package_data = {'_sounddevice_data': [libname, 'README.md']} +else: + packages = None + package_data = None + +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__, py_modules=["sounddevice"], + packages=packages, + package_data=package_data, install_requires=["CFFI"], extras_require={"NumPy": ["NumPy"]}, author="Matthias Geier", @@ -31,4 +87,5 @@ setup( "Programming Language :: Python :: 3", "Topic :: Multimedia :: Sound/Audio", ], + cmdclass=cmdclass, ) |
