diff --git a/.gitignore b/.gitignore index 4311438..a496a14 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,6 @@ build/ .cache/ .vscode/ .DS_Store -.venv/ \ No newline at end of file +.venv/ +tests/ +_soundfile.py \ No newline at end of file diff --git a/README.rst b/README.rst index df7834e..9feb70a 100644 --- a/README.rst +++ b/README.rst @@ -391,3 +391,14 @@ News - Fixed typo on library location detection if no packaged lib and no system lib was found + +2025-01-02 V0.13.0 Bastian Bechtold + Thank you, Zhong Jianxin, mcclure, jneuendorf-i4h, aoirint, endolith, Guy Illes, ytya, Sam Lapp, Benjamin Moody + + - Linux arm64 builds added + - Numpy is now a dependency + - Fixed error in blocks, if file is very short + - Compression level and bitrate controls added for compressed files + - Various README improvements + - Various build system improvements + - Various improvements to error messages \ No newline at end of file diff --git a/_soundfile_data b/_soundfile_data index dd1c4a5..a3e6f97 160000 --- a/_soundfile_data +++ b/_soundfile_data @@ -1 +1 @@ -Subproject commit dd1c4a5b2f00185b2e387431296560dd691e0a08 +Subproject commit a3e6f9769d0c7e91d2d036cf0fdbe5b4bbf18b87 diff --git a/setup.py b/setup.py index 14fa60f..1e94f44 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,6 @@ import os from platform import architecture, machine from setuptools import setup -from setuptools.command.test import test as TestCommand import sys # environment variables for cross-platform package creation @@ -34,27 +33,7 @@ package_data = None zip_safe = True - -class PyTest(TestCommand): - - user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")] - - def initialize_options(self): - TestCommand.initialize_options(self) - self.pytest_args = [] - - def finalize_options(self): - TestCommand.finalize_options(self) - self.test_args = [] - self.test_suite = True - - def run_tests(self): - # import here, cause outside the eggs aren't loaded - import pytest - errno = pytest.main(self.pytest_args) - sys.exit(errno) - -cmdclass = {'test': PyTest} +cmdclass = {} try: from wheel.bdist_wheel import bdist_wheel @@ -73,9 +52,11 @@ def get_tag(self): else: oses = 'macosx_11_0_arm64' elif platform == 'win32': - if architecture0 == '32bit': + if architecture0.lower() == 'arm64' or machine() == 'ARM64': + oses = 'win_arm64' + elif architecture0 == 'x86' or architecture0 == '32bit': oses = 'win32' - else: + elif architecture0 == 'x64' or architecture0 == '64bit': oses = 'win_amd64' elif platform == 'linux': # using the centos:7 runner with glibc2.17: @@ -84,7 +65,7 @@ def get_tag(self): else: pep600_architecture = architecture0 - oses = 'manylinux_2_17_{}'.format(pep600_architecture) + oses = 'manylinux_2_28_{}'.format(pep600_architecture) else: pythons = 'py2.py3' oses = 'any' @@ -135,6 +116,5 @@ def get_tag(self): ], long_description=open('README.rst').read(), long_description_content_type="text/x-rst", - tests_require=['pytest'], cmdclass=cmdclass, ) diff --git a/soundfile.py b/soundfile.py index 843d0ab..d04bdcf 100644 --- a/soundfile.py +++ b/soundfile.py @@ -8,7 +8,7 @@ For further information, see https://python-soundfile.readthedocs.io/. """ -__version__ = "0.12.1" +__version__ = "0.13.0" import os as _os import sys as _sys @@ -158,9 +158,11 @@ elif _sys.platform == 'win32': from platform import architecture as _architecture from platform import machine as _machine - if _machine() == 'ARM64': - _packaged_libname = 'libsndfile_arm64.dll' - elif _architecture()[0] == '64bit': + # this check can not be completed correctly: for x64 binaries running on + # arm64 Windows report the same values as arm64 binaries. For now, neither + # numpy nor cffi are available for arm64, so we can safely assume we're + # in x86 land: + if _architecture()[0] == '64bit': _packaged_libname = 'libsndfile_x64.dll' elif _architecture()[0] == '32bit': _packaged_libname = 'libsndfile_x86.dll' diff --git a/tests/test_soundfile.py b/tests/test_soundfile.py index fc0ea43..c11aa93 100644 --- a/tests/test_soundfile.py +++ b/tests/test_soundfile.py @@ -335,6 +335,9 @@ def test_write_mp3_compression(): compression_level=1, bitrate_mode='VARIABLE') assert "compression" in str(excinfo.value) + # just run one more time so we're left with a valid MP3 in the directory + sf.write(filename_mp3, data_stereo, sr, format='MP3', subtype='MPEG_LAYER_III') + def test_write_flac_compression(): sr = 44100 @@ -378,7 +381,7 @@ def test_blocks_partial_last_block(file_stereo_r): def test_blocks_fill_last_block(file_stereo_r): blocks = list(sf.blocks(file_stereo_r, blocksize=3, fill_value=0)) - last_block = np.row_stack((data_stereo[3:4], np.zeros((2, 2)))) + last_block = np.vstack((data_stereo[3:4], np.zeros((2, 2)))) assert_equal_list_of_arrays(blocks, [data_stereo[0:3], last_block]) @@ -428,7 +431,7 @@ def test_blocks_with_frames(file_stereo_r): def test_blocks_with_frames_and_fill_value(file_stereo_r): blocks = list( sf.blocks(file_stereo_r, blocksize=2, frames=3, fill_value=0)) - last_block = np.row_stack((data_stereo[2:3], np.zeros((1, 2)))) + last_block = np.vstack((data_stereo[2:3], np.zeros((1, 2)))) assert_equal_list_of_arrays(blocks, [data_stereo[0:2], last_block])