Skip to content

Commit

Permalink
Merge pull request #452 from bastibe/remove-setuptools-dependency
Browse files Browse the repository at this point in the history
removes setuptools.command.test dependency
  • Loading branch information
bastibe authored Jan 2, 2025
2 parents ed3b9c2 + 5d59816 commit aa2d6d9
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 34 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ build/
.cache/
.vscode/
.DS_Store
.venv/
.venv/
tests/
_soundfile.py
11 changes: 11 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion _soundfile_data
32 changes: 6 additions & 26 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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'
Expand Down Expand Up @@ -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,
)
10 changes: 6 additions & 4 deletions soundfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'
Expand Down
7 changes: 5 additions & 2 deletions tests/test_soundfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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])


Expand Down Expand Up @@ -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])


Expand Down

0 comments on commit aa2d6d9

Please sign in to comment.