From 35d9ff6c31d840ed828124927b7151896918f620 Mon Sep 17 00:00:00 2001 From: Bastian Bechtold Date: Mon, 30 Dec 2024 17:01:44 +0100 Subject: [PATCH 01/10] removes setuptools.command.test dependency --- setup.py | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/setup.py b/setup.py index 14fa60f..33a945c 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 From 41614fc360bd8a239e6c47965f619eb194246c1e Mon Sep 17 00:00:00 2001 From: Bastian Bechtold Date: Mon, 30 Dec 2024 17:10:04 +0100 Subject: [PATCH 02/10] deprecation warning in tests fixed --- .gitignore | 4 +++- tests/test_soundfile.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) 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/tests/test_soundfile.py b/tests/test_soundfile.py index fc0ea43..ce5a686 100644 --- a/tests/test_soundfile.py +++ b/tests/test_soundfile.py @@ -378,7 +378,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 +428,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]) From c7385b56c3010bb84b32c35b793f6b944cde6849 Mon Sep 17 00:00:00 2001 From: Bastian Bechtold Date: Thu, 2 Jan 2025 13:50:32 +0100 Subject: [PATCH 03/10] updates binaries with more compatible linux version --- _soundfile_data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_soundfile_data b/_soundfile_data index dd1c4a5..97d456c 160000 --- a/_soundfile_data +++ b/_soundfile_data @@ -1 +1 @@ -Subproject commit dd1c4a5b2f00185b2e387431296560dd691e0a08 +Subproject commit 97d456c5def1f39f2a06d65097bad01a0d784924 From 8f5b7349ef078fff5a0de65701f6022929317f08 Mon Sep 17 00:00:00 2001 From: Bastian Bechtold Date: Thu, 2 Jan 2025 14:10:51 +0100 Subject: [PATCH 04/10] MP3 test now writes valid MP3 it used to end on an exception test, which left a broken file. --- tests/test_soundfile.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test_soundfile.py b/tests/test_soundfile.py index ce5a686..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 From 9073e83f1c723ef31c5d127036d144935000f182 Mon Sep 17 00:00:00 2001 From: Bastian Bechtold Date: Thu, 2 Jan 2025 14:12:09 +0100 Subject: [PATCH 05/10] distribution tag fixes windows tags are now called x86, x64, and arm64 (from 32bit, 64bit), and manylinux version was updated to glibc 2.28. --- setup.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 33a945c..cfbf345 100644 --- a/setup.py +++ b/setup.py @@ -52,9 +52,11 @@ def get_tag(self): else: oses = 'macosx_11_0_arm64' elif platform == 'win32': - if architecture0 == '32bit': + if architecture0 == 'arm64': + oses = 'win_arm64' + elif architecture0 == 'x86': oses = 'win32' - else: + elif architecture0 == 'x64': oses = 'win_amd64' elif platform == 'linux': # using the centos:7 runner with glibc2.17: @@ -63,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' From 5a068bc377ba0ca9121669f361299ef275eec95a Mon Sep 17 00:00:00 2001 From: Bastian Bechtold Date: Thu, 2 Jan 2025 14:35:45 +0100 Subject: [PATCH 06/10] setup.py fixed on Windows tags are wildly inconsistent between various machines, especially on Windows. It's a huge mess. --- setup.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index cfbf345..1e94f44 100644 --- a/setup.py +++ b/setup.py @@ -52,11 +52,11 @@ def get_tag(self): else: oses = 'macosx_11_0_arm64' elif platform == 'win32': - if architecture0 == 'arm64': + if architecture0.lower() == 'arm64' or machine() == 'ARM64': oses = 'win_arm64' - elif architecture0 == 'x86': + elif architecture0 == 'x86' or architecture0 == '32bit': oses = 'win32' - elif architecture0 == 'x64': + elif architecture0 == 'x64' or architecture0 == '64bit': oses = 'win_amd64' elif platform == 'linux': # using the centos:7 runner with glibc2.17: @@ -116,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, ) From fd5cb0b7e46daaf958d84ce1a1bfd2d320235a1f Mon Sep 17 00:00:00 2001 From: Bastian Bechtold Date: Thu, 2 Jan 2025 14:51:12 +0100 Subject: [PATCH 07/10] updates README with latest changelog --- README.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 From a5c271df7273d8dbb478667247e6f28b501455bb Mon Sep 17 00:00:00 2001 From: Bastian Bechtold Date: Thu, 2 Jan 2025 15:05:01 +0100 Subject: [PATCH 08/10] increments version number to 0.13.0 --- soundfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soundfile.py b/soundfile.py index 843d0ab..5e201dd 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 From 80c62b841a09c225957351e0ec26d76782a25e8f Mon Sep 17 00:00:00 2001 From: Bastian Bechtold Date: Thu, 2 Jan 2025 16:20:45 +0100 Subject: [PATCH 09/10] libsndfile_arm64.so updated with fixed binary --- _soundfile_data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_soundfile_data b/_soundfile_data index 97d456c..a3e6f97 160000 --- a/_soundfile_data +++ b/_soundfile_data @@ -1 +1 @@ -Subproject commit 97d456c5def1f39f2a06d65097bad01a0d784924 +Subproject commit a3e6f9769d0c7e91d2d036cf0fdbe5b4bbf18b87 From 5d598166d4c0d5753aeaa62c9fd9cae08433f387 Mon Sep 17 00:00:00 2001 From: Bastian Bechtold Date: Thu, 2 Jan 2025 16:45:40 +0100 Subject: [PATCH 10/10] x64 fixed, when running on arm64 Windows x64 python, running on arm64 Windows, reports the exact same architecture and platform as arm64 python running on arm64 Windows. We can not distinguish between them here. For now, neither, numpy nor CFFI support arm64 python on Windows, so we can simply ignore it. This is ugly. --- soundfile.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/soundfile.py b/soundfile.py index 5e201dd..d04bdcf 100644 --- a/soundfile.py +++ b/soundfile.py @@ -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'