Skip to content
Closed
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
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,10 @@ __pycache__
dist
build
PySoundFile.egg-info
MANIFEST
MANIFEST
*.pyc
*.wav
*.raw
delme.please
.coverage
.cache
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
recursive-include pysoundfile/win sndfile32.dll sndfile64.dll sndfile_license
Binary file removed dist/PySoundFile-0.4.1.win-amd64-py2.7.exe
Binary file not shown.
Binary file removed dist/PySoundFile-0.4.1.win-amd64-py3.3.exe
Binary file not shown.
Binary file removed dist/PySoundFile-0.4.1.win32-py2.7.exe
Binary file not shown.
Binary file removed dist/PySoundFile-0.4.1.win32-py3.3.exe
Binary file not shown.
12 changes: 11 additions & 1 deletion pysoundfile.py → pysoundfile/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
from cffi import FFI as _FFI
from os import SEEK_SET, SEEK_CUR, SEEK_END

from sys import platform
from platform import architecture

try:
import builtins as _builtins
except ImportError:
Expand Down Expand Up @@ -241,7 +244,14 @@
_np.dtype('int16'): 'short'
}

_snd = _ffi.dlopen('sndfile')

try:
_snd = _ffi.dlopen('sndfile')
except OSError:
if _platform == 'win32':
_snd = _ffi.dlopen('sndfile' + _architecture()[0][:2]) # sndfile32/64
else:
raise


def read(file, frames=-1, start=0, stop=None, dtype='float64', always_2d=True,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
19 changes: 9 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
#!/usr/bin/env python
import setuptools
from setuptools import setup
from sys import platform
from platform import architecture
import shutil

if platform == 'win32' and architecture()[0] == '32bit':
shutil.copy2('win/sndfile32.dll', 'win/sndfile.dll')
sndfile = [('', ['win/sndfile.dll', 'win/sndfile_license'])]
elif platform == 'win32' and architecture()[0] == '64bit':
shutil.copy2('win/sndfile64.dll', 'win/sndfile.dll')
sndfile = [('', ['win/sndfile.dll', 'win/sndfile_license'])]
else:
sndfile = []

setup(
name='PySoundFile',
Expand All @@ -21,8 +14,7 @@
author_email='[email protected]',
url='https://github.com/bastibe/PySoundFile',
keywords=['audio', 'libsndfile'],
py_modules=['pysoundfile'],
data_files=sndfile,
packages=setuptools.find_packages(),
license='BSD 3-Clause License',
install_requires=['numpy',
'cffi>=0.6'],
Expand All @@ -41,4 +33,11 @@
'Topic :: Multimedia :: Sound/Audio'
],
long_description=open('README.rst').read(),
zip_safe=False,
include_package_data=True,
package_data={'pysoundfile': [
'pysoundfile/win/sndfile32.dll',
'pysoundfile/win/sndfile64.dll',
'pysoundfile/win/sndfile_license']
},
)