Skip to content

Commit aa2d6d9

Browse files
authored
Merge pull request #452 from bastibe/remove-setuptools-dependency
removes setuptools.command.test dependency
2 parents ed3b9c2 + 5d59816 commit aa2d6d9

File tree

6 files changed

+32
-34
lines changed

6 files changed

+32
-34
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ build/
77
.cache/
88
.vscode/
99
.DS_Store
10-
.venv/
10+
.venv/
11+
tests/
12+
_soundfile.py

README.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,3 +391,14 @@ News
391391

392392
- Fixed typo on library location detection if no packaged lib and
393393
no system lib was found
394+
395+
2025-01-02 V0.13.0 Bastian Bechtold
396+
Thank you, Zhong Jianxin, mcclure, jneuendorf-i4h, aoirint, endolith, Guy Illes, ytya, Sam Lapp, Benjamin Moody
397+
398+
- Linux arm64 builds added
399+
- Numpy is now a dependency
400+
- Fixed error in blocks, if file is very short
401+
- Compression level and bitrate controls added for compressed files
402+
- Various README improvements
403+
- Various build system improvements
404+
- Various improvements to error messages

setup.py

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import os
33
from platform import architecture, machine
44
from setuptools import setup
5-
from setuptools.command.test import test as TestCommand
65
import sys
76

87
# environment variables for cross-platform package creation
@@ -34,27 +33,7 @@
3433
package_data = None
3534
zip_safe = True
3635

37-
38-
class PyTest(TestCommand):
39-
40-
user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")]
41-
42-
def initialize_options(self):
43-
TestCommand.initialize_options(self)
44-
self.pytest_args = []
45-
46-
def finalize_options(self):
47-
TestCommand.finalize_options(self)
48-
self.test_args = []
49-
self.test_suite = True
50-
51-
def run_tests(self):
52-
# import here, cause outside the eggs aren't loaded
53-
import pytest
54-
errno = pytest.main(self.pytest_args)
55-
sys.exit(errno)
56-
57-
cmdclass = {'test': PyTest}
36+
cmdclass = {}
5837

5938
try:
6039
from wheel.bdist_wheel import bdist_wheel
@@ -73,9 +52,11 @@ def get_tag(self):
7352
else:
7453
oses = 'macosx_11_0_arm64'
7554
elif platform == 'win32':
76-
if architecture0 == '32bit':
55+
if architecture0.lower() == 'arm64' or machine() == 'ARM64':
56+
oses = 'win_arm64'
57+
elif architecture0 == 'x86' or architecture0 == '32bit':
7758
oses = 'win32'
78-
else:
59+
elif architecture0 == 'x64' or architecture0 == '64bit':
7960
oses = 'win_amd64'
8061
elif platform == 'linux':
8162
# using the centos:7 runner with glibc2.17:
@@ -84,7 +65,7 @@ def get_tag(self):
8465
else:
8566
pep600_architecture = architecture0
8667

87-
oses = 'manylinux_2_17_{}'.format(pep600_architecture)
68+
oses = 'manylinux_2_28_{}'.format(pep600_architecture)
8869
else:
8970
pythons = 'py2.py3'
9071
oses = 'any'
@@ -135,6 +116,5 @@ def get_tag(self):
135116
],
136117
long_description=open('README.rst').read(),
137118
long_description_content_type="text/x-rst",
138-
tests_require=['pytest'],
139119
cmdclass=cmdclass,
140120
)

soundfile.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
For further information, see https://python-soundfile.readthedocs.io/.
99
1010
"""
11-
__version__ = "0.12.1"
11+
__version__ = "0.13.0"
1212

1313
import os as _os
1414
import sys as _sys
@@ -158,9 +158,11 @@
158158
elif _sys.platform == 'win32':
159159
from platform import architecture as _architecture
160160
from platform import machine as _machine
161-
if _machine() == 'ARM64':
162-
_packaged_libname = 'libsndfile_arm64.dll'
163-
elif _architecture()[0] == '64bit':
161+
# this check can not be completed correctly: for x64 binaries running on
162+
# arm64 Windows report the same values as arm64 binaries. For now, neither
163+
# numpy nor cffi are available for arm64, so we can safely assume we're
164+
# in x86 land:
165+
if _architecture()[0] == '64bit':
164166
_packaged_libname = 'libsndfile_x64.dll'
165167
elif _architecture()[0] == '32bit':
166168
_packaged_libname = 'libsndfile_x86.dll'

tests/test_soundfile.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,9 @@ def test_write_mp3_compression():
335335
compression_level=1, bitrate_mode='VARIABLE')
336336
assert "compression" in str(excinfo.value)
337337

338+
# just run one more time so we're left with a valid MP3 in the directory
339+
sf.write(filename_mp3, data_stereo, sr, format='MP3', subtype='MPEG_LAYER_III')
340+
338341

339342
def test_write_flac_compression():
340343
sr = 44100
@@ -378,7 +381,7 @@ def test_blocks_partial_last_block(file_stereo_r):
378381

379382
def test_blocks_fill_last_block(file_stereo_r):
380383
blocks = list(sf.blocks(file_stereo_r, blocksize=3, fill_value=0))
381-
last_block = np.row_stack((data_stereo[3:4], np.zeros((2, 2))))
384+
last_block = np.vstack((data_stereo[3:4], np.zeros((2, 2))))
382385
assert_equal_list_of_arrays(blocks, [data_stereo[0:3], last_block])
383386

384387

@@ -428,7 +431,7 @@ def test_blocks_with_frames(file_stereo_r):
428431
def test_blocks_with_frames_and_fill_value(file_stereo_r):
429432
blocks = list(
430433
sf.blocks(file_stereo_r, blocksize=2, frames=3, fill_value=0))
431-
last_block = np.row_stack((data_stereo[2:3], np.zeros((1, 2))))
434+
last_block = np.vstack((data_stereo[2:3], np.zeros((1, 2))))
432435
assert_equal_list_of_arrays(blocks, [data_stereo[0:2], last_block])
433436

434437

0 commit comments

Comments
 (0)