Skip to content

Commit c22fe37

Browse files
committed
Can now be built as wheel on Windows and OSX
1 parent b08400d commit c22fe37

File tree

8 files changed

+1022
-6
lines changed

8 files changed

+1022
-6
lines changed

darwin/libsndfile.dylib

363 KB
Binary file not shown.
File renamed without changes.

setup.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
#!/usr/bin/env python
22
import sys
3-
from setuptools import setup
3+
from setuptools import setup, Distribution
44
from setuptools.command.test import test as TestCommand
55
from sys import platform
66
from platform import architecture
77
import shutil
88

99
if platform == 'win32' and architecture()[0] == '32bit':
10-
shutil.copy2('win/sndfile32.dll', 'win/sndfile.dll')
11-
sndfile = [('', ['win/sndfile.dll', 'win/sndfile_license'])]
10+
sndfile = [('lib', ['win32/libsndfile.dll', 'win32/sndfile_license'])]
1211
elif platform == 'win32' and architecture()[0] == '64bit':
13-
shutil.copy2('win/sndfile64.dll', 'win/sndfile.dll')
14-
sndfile = [('', ['win/sndfile.dll', 'win/sndfile_license'])]
12+
sndfile = [('lib', ['win64/libsndfile.dll', 'win64/sndfile_license'])]
13+
elif platform == 'darwin':
14+
sndfile = [('lib', ['darwin/libsndfile.dylib', 'darwin/sndfile_license'])]
1515
else:
1616
sndfile = []
1717

@@ -35,6 +35,11 @@ def run_tests(self):
3535
sys.exit(errno)
3636

3737

38+
class BinaryDistribution(Distribution):
39+
def is_pure(self):
40+
return False
41+
42+
3843
setup(
3944
name='PySoundFile',
4045
version='0.6.0',
@@ -66,4 +71,5 @@ def run_tests(self):
6671
long_description=open('README.rst').read(),
6772
tests_require=['pytest'],
6873
cmdclass={'test': PyTest},
74+
distclass=BinaryDistribution,
6975
)

soundfile.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,11 @@
238238
_np.dtype('int16'): 'short'
239239
}
240240

241-
_snd = _ffi.dlopen('sndfile')
241+
242+
try:
243+
_snd = _ffi.dlopen('sndfile')
244+
except OSError:
245+
_snd = _ffi.dlopen(_os.path.dirname(__file__)+'/../../libsndfile')
242246

243247

244248
def read(file, frames=-1, start=0, stop=None, dtype='float64', always_2d=True,
File renamed without changes.

win32/sndfile_license

Lines changed: 503 additions & 0 deletions
Large diffs are not rendered by default.
File renamed without changes.

win64/sndfile_license

Lines changed: 503 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)