From d63f379666ef46c2f9aa91a64a19dc78f87a4793 Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Wed, 8 Jun 2022 16:59:28 -0400 Subject: [PATCH 01/43] ABI mode to API mode transition on cffi Build error on win32 due to the declaration: """ SNDFILE* sf_wchar_open (const wchar_t *wpath, int mode, SF_INFO *sfinfo); """ Perhaps it should be removed. Tested on Macbook Pro M1 --- README.rst | 1 + setup.py | 2 +- soundfile.py | 165 ++++----------------------------------------- soundfile_build.py | 34 +++++++--- 4 files changed, 42 insertions(+), 160 deletions(-) diff --git a/README.rst b/README.rst index f7a7edb..28ac60b 100644 --- a/README.rst +++ b/README.rst @@ -52,6 +52,7 @@ In 0.9.0, we changed the ``ctype`` arguments of the ``buffer_*`` methods to ``dtype``, using the Numpy ``dtype`` notation. The old ``ctype`` arguments still work, but are now officially deprecated. +In 0.11.0 switched from cffi ABI mode to API mode Installation ------------ diff --git a/setup.py b/setup.py index bed16f1..2fef332 100644 --- a/setup.py +++ b/setup.py @@ -87,7 +87,7 @@ def get_tag(self): setup( name='soundfile', - version='0.10.3post1', + version='0.11.1', description='An audio library based on libsndfile, CFFI and NumPy', author='Bastian Bechtold', author_email='basti@bastibe.de', diff --git a/soundfile.py b/soundfile.py index b15a706..925dee8 100644 --- a/soundfile.py +++ b/soundfile.py @@ -8,7 +8,7 @@ For further information, see https://python-soundfile.readthedocs.io/. """ -__version__ = "0.10.3" +__version__ = "0.11.1" import os as _os import sys as _sys @@ -16,6 +16,7 @@ from os import SEEK_SET, SEEK_CUR, SEEK_END from ctypes.util import find_library as _find_library from _soundfile import ffi as _ffi +from _soundfile import lib try: _unicode = unicode # doesn't exist in Python 3.x @@ -23,6 +24,7 @@ _unicode = str + _str_types = { 'title': 0x01, 'copyright': 0x02, @@ -384,146 +386,6 @@ def blocks(file, blocksize=None, overlap=0, frames=-1, start=0, stop=None, yield block -class _SoundFileInfo(object): - """Information about a SoundFile""" - - def __init__(self, file, verbose): - self.verbose = verbose - with SoundFile(file) as f: - self.name = f.name - self.samplerate = f.samplerate - self.channels = f.channels - self.frames = f.frames - self.duration = float(self.frames)/f.samplerate - self.format = f.format - self.subtype = f.subtype - self.endian = f.endian - self.format_info = f.format_info - self.subtype_info = f.subtype_info - self.sections = f.sections - self.extra_info = f.extra_info - - @property - def _duration_str(self): - hours, rest = divmod(self.duration, 3600) - minutes, seconds = divmod(rest, 60) - if hours >= 1: - duration = "{0:.0g}:{1:02.0g}:{2:05.3f} h".format(hours, minutes, seconds) - elif minutes >= 1: - duration = "{0:02.0g}:{1:05.3f} min".format(minutes, seconds) - elif seconds <= 1: - duration = "{0:d} samples".format(self.frames) - else: - duration = "{0:.3f} s".format(seconds) - return duration - - def __repr__(self): - info = "\n".join( - ["{0.name}", - "samplerate: {0.samplerate} Hz", - "channels: {0.channels}", - "duration: {0._duration_str}", - "format: {0.format_info} [{0.format}]", - "subtype: {0.subtype_info} [{0.subtype}]"]) - if self.verbose: - info += "\n".join( - ["\nendian: {0.endian}", - "sections: {0.sections}", - "frames: {0.frames}", - 'extra_info: """', - ' {1}"""']) - indented_extra_info = ("\n"+" "*4).join(self.extra_info.split("\n")) - return info.format(self, indented_extra_info) - - -def info(file, verbose=False): - """Returns an object with information about a `SoundFile`. - - Parameters - ---------- - verbose : bool - Whether to print additional information. - """ - return _SoundFileInfo(file, verbose) - - -def available_formats(): - """Return a dictionary of available major formats. - - Examples - -------- - >>> import soundfile as sf - >>> sf.available_formats() - {'FLAC': 'FLAC (FLAC Lossless Audio Codec)', - 'OGG': 'OGG (OGG Container format)', - 'WAV': 'WAV (Microsoft)', - 'AIFF': 'AIFF (Apple/SGI)', - ... - 'WAVEX': 'WAVEX (Microsoft)', - 'RAW': 'RAW (header-less)', - 'MAT5': 'MAT5 (GNU Octave 2.1 / Matlab 5.0)'} - - """ - return dict(_available_formats_helper(_snd.SFC_GET_FORMAT_MAJOR_COUNT, - _snd.SFC_GET_FORMAT_MAJOR)) - - -def available_subtypes(format=None): - """Return a dictionary of available subtypes. - - Parameters - ---------- - format : str - If given, only compatible subtypes are returned. - - Examples - -------- - >>> import soundfile as sf - >>> sf.available_subtypes('FLAC') - {'PCM_24': 'Signed 24 bit PCM', - 'PCM_16': 'Signed 16 bit PCM', - 'PCM_S8': 'Signed 8 bit PCM'} - - """ - subtypes = _available_formats_helper(_snd.SFC_GET_FORMAT_SUBTYPE_COUNT, - _snd.SFC_GET_FORMAT_SUBTYPE) - return dict((subtype, name) for subtype, name in subtypes - if format is None or check_format(format, subtype)) - - -def check_format(format, subtype=None, endian=None): - """Check if the combination of format/subtype/endian is valid. - - Examples - -------- - >>> import soundfile as sf - >>> sf.check_format('WAV', 'PCM_24') - True - >>> sf.check_format('FLAC', 'VORBIS') - False - - """ - try: - return bool(_format_int(format, subtype, endian)) - except (ValueError, TypeError): - return False - - -def default_subtype(format): - """Return the default subtype for a given format. - - Examples - -------- - >>> import soundfile as sf - >>> sf.default_subtype('WAV') - 'PCM_16' - >>> sf.default_subtype('MAT5') - 'DOUBLE' - - """ - _check_format(format) - return _default_subtypes.get(format.upper()) - class SoundFile(object): """A sound file. @@ -1205,7 +1067,7 @@ def _open(self, file, mode_int, closefd): def _init_virtual_io(self, file): """Initialize callback functions for sf_open_virtual().""" - @_ffi.callback("sf_vio_get_filelen") + @_ffi.def_extern() def vio_get_filelen(user_data): curr = file.tell() file.seek(0, SEEK_END) @@ -1213,12 +1075,13 @@ def vio_get_filelen(user_data): file.seek(curr, SEEK_SET) return size - @_ffi.callback("sf_vio_seek") + @_ffi.def_extern() def vio_seek(offset, whence, user_data): file.seek(offset, whence) return file.tell() - @_ffi.callback("sf_vio_read") + # @_ffi.callback("sf_vio_read") + @_ffi.def_extern() def vio_read(ptr, count, user_data): # first try readinto(), if not available fall back to read() try: @@ -1231,7 +1094,7 @@ def vio_read(ptr, count, user_data): buf[0:data_read] = data return data_read - @_ffi.callback("sf_vio_write") + @_ffi.def_extern() def vio_write(ptr, count, user_data): buf = _ffi.buffer(ptr, count) data = buf[:] @@ -1241,16 +1104,16 @@ def vio_write(ptr, count, user_data): written = count return written - @_ffi.callback("sf_vio_tell") + @_ffi.def_extern() def vio_tell(user_data): return file.tell() # Note: the callback functions must be kept alive! - self._virtual_io = {'get_filelen': vio_get_filelen, - 'seek': vio_seek, - 'read': vio_read, - 'write': vio_write, - 'tell': vio_tell} + self._virtual_io = {'get_filelen': lib.vio_get_filelen, + 'seek': lib.vio_seek, + 'read': lib.vio_read, + 'write': lib.vio_write, + 'tell': lib.vio_tell} return _ffi.new("SF_VIRTUAL_IO*", self._virtual_io) diff --git a/soundfile_build.py b/soundfile_build.py index 774fd9b..7282a74 100644 --- a/soundfile_build.py +++ b/soundfile_build.py @@ -1,9 +1,15 @@ import os import sys from cffi import FFI +platform = os.environ.get('PYSOUNDFILE_PLATFORM', sys.platform) +print(platform) ffibuilder = FFI() -ffibuilder.set_source("_soundfile", None) + +ffibuilder.set_source('_soundfile', ''' +#include +''', libraries=['sndfile']) + ffibuilder.cdef(""" enum { @@ -44,6 +50,8 @@ typedef struct SNDFILE_tag SNDFILE ; + + typedef struct SF_INFO { sf_count_t frames ; /* Used to be called samples. Changed to avoid confusion. */ @@ -52,8 +60,15 @@ int format ; int sections ; int seekable ; -} SF_INFO ; +} SF_INFO ;""") + +if platform == 'win32': + ffibuilder.cdef(""" + SNDFILE* sf_wchar_open (const wchar_t *wpath, int mode, SF_INFO *sfinfo); + """) +ffibuilder.cdef( +""" SNDFILE* sf_open (const char *path, int mode, SF_INFO *sfinfo) ; int sf_format_check (const SF_INFO *info) ; @@ -108,6 +123,7 @@ typedef sf_count_t (*sf_vio_write) (const void *ptr, sf_count_t count, void *user_data) ; typedef sf_count_t (*sf_vio_tell) (void *user_data) ; + typedef struct SF_VIRTUAL_IO { sf_count_t (*get_filelen) (void *user_data) ; sf_count_t (*seek) (sf_count_t offset, int whence, void *user_data) ; @@ -116,6 +132,7 @@ sf_count_t (*tell) (void *user_data) ; } SF_VIRTUAL_IO ; + SNDFILE* sf_open_virtual (SF_VIRTUAL_IO *sfvirtual, int mode, SF_INFO *sfinfo, void *user_data) ; SNDFILE* sf_open_fd (int fd, int mode, SF_INFO *sfinfo, int close_desc) ; @@ -125,13 +142,14 @@ const char* name ; const char* extension ; } SF_FORMAT_INFO ; -""") -platform = os.environ.get('PYSOUNDFILE_PLATFORM', sys.platform) -if platform == 'win32': - ffibuilder.cdef(""" - SNDFILE* sf_wchar_open (const wchar_t *wpath, int mode, SF_INFO *sfinfo) ; - """) +extern "Python" sf_count_t vio_get_filelen (void *user_data) ; +extern "Python" sf_count_t vio_seek (sf_count_t offset, int whence, void *user_data) ; +extern "Python" sf_count_t vio_read (void *ptr, sf_count_t count, void *user_data) ; +extern "Python" sf_count_t vio_write (const void *ptr, sf_count_t count, void *user_data) ; +extern "Python" sf_count_t vio_tell (void *user_data) ; + +""") if __name__ == "__main__": ffibuilder.compile(verbose=True) From f34b24b8f79d47b234c15bc94ed8f60748f812f9 Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Wed, 8 Jun 2022 18:23:39 -0400 Subject: [PATCH 02/43] correct soundfile.py --- README.rst | 1 + setup.py | 2 +- soundfile.py | 25 ++++++++++++++----------- soundfile_build.py | 35 +++++++++++++++++++++++++++-------- 4 files changed, 43 insertions(+), 20 deletions(-) diff --git a/README.rst b/README.rst index f7a7edb..28ac60b 100644 --- a/README.rst +++ b/README.rst @@ -52,6 +52,7 @@ In 0.9.0, we changed the ``ctype`` arguments of the ``buffer_*`` methods to ``dtype``, using the Numpy ``dtype`` notation. The old ``ctype`` arguments still work, but are now officially deprecated. +In 0.11.0 switched from cffi ABI mode to API mode Installation ------------ diff --git a/setup.py b/setup.py index bed16f1..2fef332 100644 --- a/setup.py +++ b/setup.py @@ -87,7 +87,7 @@ def get_tag(self): setup( name='soundfile', - version='0.10.3post1', + version='0.11.1', description='An audio library based on libsndfile, CFFI and NumPy', author='Bastian Bechtold', author_email='basti@bastibe.de', diff --git a/soundfile.py b/soundfile.py index b15a706..287b618 100644 --- a/soundfile.py +++ b/soundfile.py @@ -8,7 +8,7 @@ For further information, see https://python-soundfile.readthedocs.io/. """ -__version__ = "0.10.3" +__version__ = "0.11.1" import os as _os import sys as _sys @@ -16,6 +16,7 @@ from os import SEEK_SET, SEEK_CUR, SEEK_END from ctypes.util import find_library as _find_library from _soundfile import ffi as _ffi +from _soundfile import lib try: _unicode = unicode # doesn't exist in Python 3.x @@ -23,6 +24,7 @@ _unicode = str + _str_types = { 'title': 0x01, 'copyright': 0x02, @@ -1205,7 +1207,7 @@ def _open(self, file, mode_int, closefd): def _init_virtual_io(self, file): """Initialize callback functions for sf_open_virtual().""" - @_ffi.callback("sf_vio_get_filelen") + @_ffi.def_extern() def vio_get_filelen(user_data): curr = file.tell() file.seek(0, SEEK_END) @@ -1213,12 +1215,13 @@ def vio_get_filelen(user_data): file.seek(curr, SEEK_SET) return size - @_ffi.callback("sf_vio_seek") + @_ffi.def_extern() def vio_seek(offset, whence, user_data): file.seek(offset, whence) return file.tell() - @_ffi.callback("sf_vio_read") + # @_ffi.callback("sf_vio_read") + @_ffi.def_extern() def vio_read(ptr, count, user_data): # first try readinto(), if not available fall back to read() try: @@ -1231,7 +1234,7 @@ def vio_read(ptr, count, user_data): buf[0:data_read] = data return data_read - @_ffi.callback("sf_vio_write") + @_ffi.def_extern() def vio_write(ptr, count, user_data): buf = _ffi.buffer(ptr, count) data = buf[:] @@ -1241,16 +1244,16 @@ def vio_write(ptr, count, user_data): written = count return written - @_ffi.callback("sf_vio_tell") + @_ffi.def_extern() def vio_tell(user_data): return file.tell() # Note: the callback functions must be kept alive! - self._virtual_io = {'get_filelen': vio_get_filelen, - 'seek': vio_seek, - 'read': vio_read, - 'write': vio_write, - 'tell': vio_tell} + self._virtual_io = {'get_filelen': lib.vio_get_filelen, + 'seek': lib.vio_seek, + 'read': lib.vio_read, + 'write': lib.vio_write, + 'tell': lib.vio_tell} return _ffi.new("SF_VIRTUAL_IO*", self._virtual_io) diff --git a/soundfile_build.py b/soundfile_build.py index 774fd9b..12aa1e9 100644 --- a/soundfile_build.py +++ b/soundfile_build.py @@ -2,8 +2,15 @@ import sys from cffi import FFI +platform = os.environ.get('PYSOUNDFILE_PLATFORM', sys.platform) +print(platform) + ffibuilder = FFI() -ffibuilder.set_source("_soundfile", None) + +ffibuilder.set_source('_soundfile', ''' +#include +''', libraries=['sndfile']) + ffibuilder.cdef(""" enum { @@ -44,6 +51,8 @@ typedef struct SNDFILE_tag SNDFILE ; + + typedef struct SF_INFO { sf_count_t frames ; /* Used to be called samples. Changed to avoid confusion. */ @@ -52,8 +61,15 @@ int format ; int sections ; int seekable ; -} SF_INFO ; +} SF_INFO ;""") + +if platform == 'win32': + ffibuilder.cdef(""" + SNDFILE* sf_wchar_open (const wchar_t *wpath, int mode, SF_INFO *sfinfo); + """) +ffibuilder.cdef( +""" SNDFILE* sf_open (const char *path, int mode, SF_INFO *sfinfo) ; int sf_format_check (const SF_INFO *info) ; @@ -108,6 +124,7 @@ typedef sf_count_t (*sf_vio_write) (const void *ptr, sf_count_t count, void *user_data) ; typedef sf_count_t (*sf_vio_tell) (void *user_data) ; + typedef struct SF_VIRTUAL_IO { sf_count_t (*get_filelen) (void *user_data) ; sf_count_t (*seek) (sf_count_t offset, int whence, void *user_data) ; @@ -116,6 +133,7 @@ sf_count_t (*tell) (void *user_data) ; } SF_VIRTUAL_IO ; + SNDFILE* sf_open_virtual (SF_VIRTUAL_IO *sfvirtual, int mode, SF_INFO *sfinfo, void *user_data) ; SNDFILE* sf_open_fd (int fd, int mode, SF_INFO *sfinfo, int close_desc) ; @@ -125,13 +143,14 @@ const char* name ; const char* extension ; } SF_FORMAT_INFO ; -""") -platform = os.environ.get('PYSOUNDFILE_PLATFORM', sys.platform) -if platform == 'win32': - ffibuilder.cdef(""" - SNDFILE* sf_wchar_open (const wchar_t *wpath, int mode, SF_INFO *sfinfo) ; - """) +extern "Python" sf_count_t vio_get_filelen (void *user_data) ; +extern "Python" sf_count_t vio_seek (sf_count_t offset, int whence, void *user_data) ; +extern "Python" sf_count_t vio_read (void *ptr, sf_count_t count, void *user_data) ; +extern "Python" sf_count_t vio_write (const void *ptr, sf_count_t count, void *user_data) ; +extern "Python" sf_count_t vio_tell (void *user_data) ; + +""") if __name__ == "__main__": ffibuilder.compile(verbose=True) From e1d1410d21b88458d2030e14dc64be68471d56ac Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Wed, 8 Jun 2022 18:26:45 -0400 Subject: [PATCH 03/43] printing platform when building --- soundfile_build.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/soundfile_build.py b/soundfile_build.py index fe3c815..7282a74 100644 --- a/soundfile_build.py +++ b/soundfile_build.py @@ -4,9 +4,6 @@ platform = os.environ.get('PYSOUNDFILE_PLATFORM', sys.platform) print(platform) -platform = os.environ.get('PYSOUNDFILE_PLATFORM', sys.platform) -print(platform) - ffibuilder = FFI() ffibuilder.set_source('_soundfile', ''' From 7bbc19d23d23aa438bc12bcfbd67962afbf42e4a Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Sat, 25 Jun 2022 20:17:24 -0400 Subject: [PATCH 04/43] Restored _SoundFileInfo --- soundfile.py | 131 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 131 insertions(+) diff --git a/soundfile.py b/soundfile.py index 925dee8..496c74b 100644 --- a/soundfile.py +++ b/soundfile.py @@ -385,6 +385,137 @@ def blocks(file, blocksize=None, overlap=0, frames=-1, start=0, stop=None, dtype, always_2d, fill_value, out): yield block +class _SoundFileInfo(object): + """Information about a SoundFile""" + + def __init__(self, file, verbose): + self.verbose = verbose + with SoundFile(file) as f: + self.name = f.name + self.samplerate = f.samplerate + self.channels = f.channels + self.frames = f.frames + self.duration = float(self.frames)/f.samplerate + self.format = f.format + self.subtype = f.subtype + self.endian = f.endian + self.format_info = f.format_info + self.subtype_info = f.subtype_info + self.sections = f.sections + self.extra_info = f.extra_info + + @property + def _duration_str(self): + hours, rest = divmod(self.duration, 3600) + minutes, seconds = divmod(rest, 60) + if hours >= 1: + duration = "{0:.0g}:{1:02.0g}:{2:05.3f} h".format(hours, minutes, seconds) + elif minutes >= 1: + duration = "{0:02.0g}:{1:05.3f} min".format(minutes, seconds) + elif seconds <= 1: + duration = "{0:d} samples".format(self.frames) + else: + duration = "{0:.3f} s".format(seconds) + return duration + + def __repr__(self): + info = "\n".join( + ["{0.name}", + "samplerate: {0.samplerate} Hz", + "channels: {0.channels}", + "duration: {0._duration_str}", + "format: {0.format_info} [{0.format}]", + "subtype: {0.subtype_info} [{0.subtype}]"]) + if self.verbose: + info += "\n".join( + ["\nendian: {0.endian}", + "sections: {0.sections}", + "frames: {0.frames}", + 'extra_info: """', + ' {1}"""']) + indented_extra_info = ("\n"+" "*4).join(self.extra_info.split("\n")) + return info.format(self, indented_extra_info) + + +def info(file, verbose=False): + """Returns an object with information about a `SoundFile`. + Parameters + ---------- + verbose : bool + Whether to print additional information. + """ + return _SoundFileInfo(file, verbose) + + +def available_formats(): + """Return a dictionary of available major formats. + Examples + -------- + >>> import soundfile as sf + >>> sf.available_formats() + {'FLAC': 'FLAC (FLAC Lossless Audio Codec)', + 'OGG': 'OGG (OGG Container format)', + 'WAV': 'WAV (Microsoft)', + 'AIFF': 'AIFF (Apple/SGI)', + ... + 'WAVEX': 'WAVEX (Microsoft)', + 'RAW': 'RAW (header-less)', + 'MAT5': 'MAT5 (GNU Octave 2.1 / Matlab 5.0)'} + """ + return dict(_available_formats_helper(_snd.SFC_GET_FORMAT_MAJOR_COUNT, + _snd.SFC_GET_FORMAT_MAJOR)) + + +def available_subtypes(format=None): + """Return a dictionary of available subtypes. + Parameters + ---------- + format : str + If given, only compatible subtypes are returned. + Examples + -------- + >>> import soundfile as sf + >>> sf.available_subtypes('FLAC') + {'PCM_24': 'Signed 24 bit PCM', + 'PCM_16': 'Signed 16 bit PCM', + 'PCM_S8': 'Signed 8 bit PCM'} + """ + subtypes = _available_formats_helper(_snd.SFC_GET_FORMAT_SUBTYPE_COUNT, + _snd.SFC_GET_FORMAT_SUBTYPE) + return dict((subtype, name) for subtype, name in subtypes + if format is None or check_format(format, subtype)) + + +def check_format(format, subtype=None, endian=None): + """Check if the combination of format/subtype/endian is valid. + Examples + -------- + >>> import soundfile as sf + >>> sf.check_format('WAV', 'PCM_24') + True + >>> sf.check_format('FLAC', 'VORBIS') + False + """ + try: + return bool(_format_int(format, subtype, endian)) + except (ValueError, TypeError): + return False + + +def default_subtype(format): + """Return the default subtype for a given format. + Examples + -------- + >>> import soundfile as sf + >>> sf.default_subtype('WAV') + 'PCM_16' + >>> sf.default_subtype('MAT5') + 'DOUBLE' + """ + _check_format(format) + return _default_subtypes.get(format.upper()) + + class SoundFile(object): From c1338ff2bbb64243ecfcabb26088038c1eb3769f Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Sat, 30 Jul 2022 12:58:54 -0600 Subject: [PATCH 05/43] Added test workflow --- .github/workflows/main.yml | 59 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..cd56371 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,59 @@ +# This is a basic workflow to help you get started with Actions +name: CI +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the "master" branch + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# name: Python Package + +# on: [push, pull_request] + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-20.04, windows-2019, macos-10.15] + python-version: + - "3.6" + - "3.7" + - "3.8" + - "3.9" + - "3.10" + - "pypy-3.7" + - "pypy-3.8" + architecture: ["x86", "x64"] + exclude: + - os: macos-10.15 # Can't compile Numpy for this implementation. + python-version: "pypy-3.7" + - os: macos-10.15 + architecture: "x86" + - os: ubuntu-20.04 + architecture: "x86" + + steps: + - name: Install APT dependencies + if: runner.os == 'Linux' + run: sudo apt-get install libsndfile1 libsndfile1-dev + - uses: actions/checkout@v2 + with: + submodules: true + - uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + architecture: ${{ matrix.architecture }} + - name: Install requirements + run: pip install numpy pytest + - name: Install editable package + run: pip install --editable . --verbose + - name: Run tests + run: python -m pytest + From 73f02313ffe80399123b8dc48ca6d0a550aa22f6 Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Sun, 31 Jul 2022 10:19:36 -0600 Subject: [PATCH 06/43] Update main.yml Added cffi requirement --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cd56371..7268537 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -51,7 +51,7 @@ jobs: python-version: ${{ matrix.python-version }} architecture: ${{ matrix.architecture }} - name: Install requirements - run: pip install numpy pytest + run: pip install numpy pytest cffi - name: Install editable package run: pip install --editable . --verbose - name: Run tests From 314a125a7462de9085b960a44643279949aaa5db Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Sun, 31 Jul 2022 11:08:43 -0600 Subject: [PATCH 07/43] Update .travis.yml libsndfile1 -> libsndfile1-dev --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e952beb..e5444e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,7 @@ python: addons: apt: packages: - - libsndfile1 + - libsndfile1-dev install: - "if [[ $TRAVIS_PYTHON_VERSION == pypy ]]; then pip install git+https://bitbucket.org/pypy/numpy.git ; fi" script: From 831aa8a6583630d021aa9bb793a0bda297ece22d Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Wed, 3 Aug 2022 21:04:41 -0400 Subject: [PATCH 08/43] Tsting workflow for windows --- .github/workflows/main.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7268537..1b8e097 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,18 +31,23 @@ jobs: - "pypy-3.7" - "pypy-3.8" architecture: ["x86", "x64"] - exclude: - - os: macos-10.15 # Can't compile Numpy for this implementation. - python-version: "pypy-3.7" - - os: macos-10.15 - architecture: "x86" - - os: ubuntu-20.04 - architecture: "x86" +# exclude: +# - os: macos-10.15 # Can't compile Numpy for this implementation. +# python-version: "pypy-3.7" +# - os: macos-10.15 +# architecture: "x86" +# - os: ubuntu-20.04 +# architecture: "x86" steps: - name: Install APT dependencies if: runner.os == 'Linux' run: sudo apt-get install libsndfile1 libsndfile1-dev + - name: Install choco for Windows + - name: Build on Windows + if: runner.os == 'Windows' + run: choco install libsndfile + - uses: actions/checkout@v2 with: submodules: true From 67f4927576a5e176d99c9ee691dd73e898d8a73f Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Wed, 3 Aug 2022 21:06:29 -0400 Subject: [PATCH 09/43] workflows more --- .github/workflows/main.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1b8e097..b22a5b9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -43,11 +43,10 @@ jobs: - name: Install APT dependencies if: runner.os == 'Linux' run: sudo apt-get install libsndfile1 libsndfile1-dev - - name: Install choco for Windows +# - name: Install choco for Windows - name: Build on Windows if: runner.os == 'Windows' run: choco install libsndfile - - uses: actions/checkout@v2 with: submodules: true From 18d9476d509ebd17efea639f629605a9b01b39f1 Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Wed, 3 Aug 2022 21:08:12 -0400 Subject: [PATCH 10/43] excludes some architectures --- .github/workflows/main.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b22a5b9..0b16e9c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,13 +31,13 @@ jobs: - "pypy-3.7" - "pypy-3.8" architecture: ["x86", "x64"] -# exclude: -# - os: macos-10.15 # Can't compile Numpy for this implementation. -# python-version: "pypy-3.7" -# - os: macos-10.15 -# architecture: "x86" -# - os: ubuntu-20.04 -# architecture: "x86" + exclude: + - os: macos-10.15 # Can't compile Numpy for this implementation. + python-version: "pypy-3.7" + - os: macos-10.15 + architecture: "x86" + - os: ubuntu-20.04 + architecture: "x86" steps: - name: Install APT dependencies From c519562eab9b4ba89b82fcdcb5e491477b6202b7 Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Wed, 3 Aug 2022 22:00:09 -0400 Subject: [PATCH 11/43] editting windows includes --- .github/workflows/main.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0b16e9c..61deb36 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -46,7 +46,17 @@ jobs: # - name: Install choco for Windows - name: Build on Windows if: runner.os == 'Windows' - run: choco install libsndfile + run: | + choco install libsndfile + New-Item -ItemType Junction -Path "C:\libsndfile" -Target "C:\Program Files\libsndfile" + $Env:windir + $Env:INCLUDE + $Env:LIB + $Env:PATH + $Env:PATH += ';C:\libsnfile\bin' + $Env:INCLUDE += ';C:\libsnfile\include' +#Set-Item -Path Env:CGO_LDFLAGS -Value "-LC:\libsndfile\bin" + - uses: actions/checkout@v2 with: submodules: true From fff4ca7989a5f01e2f715d0476af6163ee6b846f Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Wed, 3 Aug 2022 22:01:41 -0400 Subject: [PATCH 12/43] Create windows.yaml windows actions --- .github/workflows/windows.yaml | 62 ++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/workflows/windows.yaml diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml new file mode 100644 index 0000000..751b068 --- /dev/null +++ b/.github/workflows/windows.yaml @@ -0,0 +1,62 @@ +# This is a basic workflow to help you get started with Actions +name: CI +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the "master" branch + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# name: Python Package + +# on: [push, pull_request] + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [windows-2019] + python-version: + - "3.6" + - "3.7" + - "3.8" + - "3.9" + - "3.10" + - "pypy-3.7" + - "pypy-3.8" + architecture: ["x86", "x64"] + + steps: + - name: Build on Windows + if: runner.os == 'Windows' + run: | + choco install libsndfile + New-Item -ItemType Junction -Path "C:\libsndfile" -Target "C:\Program Files\libsndfile" + $Env:windir + $Env:INCLUDE + $Env:LIB + $Env:PATH + $Env:PATH += ';C:\libsnfile\bin' + $Env:INCLUDE += ';C:\libsnfile\include' +#Set-Item -Path Env:CGO_LDFLAGS -Value "-LC:\libsndfile\bin" + + - uses: actions/checkout@v2 + with: + submodules: true + - uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + architecture: ${{ matrix.architecture }} + - name: Install requirements + run: pip install numpy pytest cffi + - name: Install editable package + run: pip install --editable . --verbose + - name: Run tests + run: python -m pytest + From 79911013a23774fc5eb98e2f2462370f4fa55cdf Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Wed, 3 Aug 2022 22:09:45 -0400 Subject: [PATCH 13/43] Update windows.yaml --- .github/workflows/windows.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml index 751b068..93f129f 100644 --- a/.github/workflows/windows.yaml +++ b/.github/workflows/windows.yaml @@ -44,6 +44,8 @@ jobs: $Env:PATH $Env:PATH += ';C:\libsnfile\bin' $Env:INCLUDE += ';C:\libsnfile\include' + refreshenv + vswhere.exe -latest -property installationPath #Set-Item -Path Env:CGO_LDFLAGS -Value "-LC:\libsndfile\bin" - uses: actions/checkout@v2 From 876ae026fda3721c590864fee0438487dc5d64be Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Wed, 3 Aug 2022 22:22:32 -0400 Subject: [PATCH 14/43] Update windows.yaml --- .github/workflows/windows.yaml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml index 93f129f..551be77 100644 --- a/.github/workflows/windows.yaml +++ b/.github/workflows/windows.yaml @@ -38,14 +38,16 @@ jobs: run: | choco install libsndfile New-Item -ItemType Junction -Path "C:\libsndfile" -Target "C:\Program Files\libsndfile" + Set-Item -Path Env:LIB -Value "-LC:\libsndfile\bin" + Set-Item -Path Env:INCLUDE -Value "-IC:\libsndfile\include" $Env:windir + refreshenv + vswhere.exe -latest -property installationPath $Env:INCLUDE $Env:LIB $Env:PATH - $Env:PATH += ';C:\libsnfile\bin' - $Env:INCLUDE += ';C:\libsnfile\include' - refreshenv - vswhere.exe -latest -property installationPath +# $Env:PATH += ';C:\libsnfile\bin +# $Env:INCLUDE += ';C:\libsnfile\include' #Set-Item -Path Env:CGO_LDFLAGS -Value "-LC:\libsndfile\bin" - uses: actions/checkout@v2 From 3f271cfa01eb9d2224f06c5b8c938d497d07e887 Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Wed, 3 Aug 2022 22:35:32 -0400 Subject: [PATCH 15/43] Update setup.py --- setup.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/setup.py b/setup.py index 2fef332..16b6705 100644 --- a/setup.py +++ b/setup.py @@ -4,6 +4,7 @@ from setuptools import setup from setuptools.command.test import test as TestCommand import sys +import sysconfig PYTHON_INTERPRETERS = '.'.join([ 'cp26', 'cp27', @@ -85,6 +86,10 @@ def get_tag(self): cmdclass['bdist_wheel'] = bdist_wheel_half_pure +try: + extra_compile_args = sysconfig.get_config_var('CFLAGS').split() +except: + extra_compile_args = [] setup( name='soundfile', version='0.11.1', @@ -118,6 +123,7 @@ def get_tag(self): 'Topic :: Multimedia :: Sound/Audio', ], long_description=open('README.rst').read(), + extra_compile_args=extra_compile_args, long_description_content_type="text/x-rst", tests_require=['pytest'], cmdclass=cmdclass, From afe60c5488c3937f3568a094f31291d5aaafe488 Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Wed, 3 Aug 2022 22:36:12 -0400 Subject: [PATCH 16/43] Update windows.yaml --- .github/workflows/windows.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml index 551be77..8983ec4 100644 --- a/.github/workflows/windows.yaml +++ b/.github/workflows/windows.yaml @@ -43,9 +43,10 @@ jobs: $Env:windir refreshenv vswhere.exe -latest -property installationPath - $Env:INCLUDE - $Env:LIB - $Env:PATH + Set-Item -Path Env:CFLAGS -Value "-IC:\wkhtmltopdf\include" +# $Env:INCLUDE +# $Env:LIB +# $Env:PATH # $Env:PATH += ';C:\libsnfile\bin # $Env:INCLUDE += ';C:\libsnfile\include' #Set-Item -Path Env:CGO_LDFLAGS -Value "-LC:\libsndfile\bin" From 379036559b71e128a2174763bc4e69147d7d4ffa Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Wed, 3 Aug 2022 22:36:25 -0400 Subject: [PATCH 17/43] Update windows.yaml --- .github/workflows/windows.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml index 8983ec4..1b3146d 100644 --- a/.github/workflows/windows.yaml +++ b/.github/workflows/windows.yaml @@ -43,7 +43,7 @@ jobs: $Env:windir refreshenv vswhere.exe -latest -property installationPath - Set-Item -Path Env:CFLAGS -Value "-IC:\wkhtmltopdf\include" + Set-Item -Path Env:CFLAGS -Value "-IC:\libsndfile\include" # $Env:INCLUDE # $Env:LIB # $Env:PATH From 1694bb86fbb2d2e8e4972b1502a895f9a6eaeda0 Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Wed, 3 Aug 2022 22:58:39 -0400 Subject: [PATCH 18/43] Update setup.py --- setup.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 16b6705..eeca159 100644 --- a/setup.py +++ b/setup.py @@ -5,6 +5,7 @@ from setuptools.command.test import test as TestCommand import sys import sysconfig +from setuptools.extension import Extension PYTHON_INTERPRETERS = '.'.join([ 'cp26', 'cp27', @@ -123,7 +124,18 @@ def get_tag(self): 'Topic :: Multimedia :: Sound/Audio', ], long_description=open('README.rst').read(), - extra_compile_args=extra_compile_args, + ext_modules=[ + Extension("MyExtension", + sources=[ + '...', + ], + include_dirs=[ + os.path.join(os.getcwd(), 'include'), + ], + library_dirs = [os.getcwd(),], # path to .a or .so file(s) + extra_compile_args=extra_compile_args, + ), + ] long_description_content_type="text/x-rst", tests_require=['pytest'], cmdclass=cmdclass, From dee629f350f8ee3f9ae586db23477507ea53dd6f Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Wed, 3 Aug 2022 23:01:12 -0400 Subject: [PATCH 19/43] Update setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index eeca159..2e16c27 100644 --- a/setup.py +++ b/setup.py @@ -135,7 +135,7 @@ def get_tag(self): library_dirs = [os.getcwd(),], # path to .a or .so file(s) extra_compile_args=extra_compile_args, ), - ] + ], long_description_content_type="text/x-rst", tests_require=['pytest'], cmdclass=cmdclass, From 1dc09e6082528aeb55a94da7a354374ff594de7d Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Wed, 3 Aug 2022 23:20:10 -0400 Subject: [PATCH 20/43] Update setup.py --- setup.py | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/setup.py b/setup.py index 2e16c27..093973b 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ from setuptools import setup from setuptools.command.test import test as TestCommand import sys -import sysconfig + from setuptools.extension import Extension PYTHON_INTERPRETERS = '.'.join([ @@ -87,10 +87,6 @@ def get_tag(self): cmdclass['bdist_wheel'] = bdist_wheel_half_pure -try: - extra_compile_args = sysconfig.get_config_var('CFLAGS').split() -except: - extra_compile_args = [] setup( name='soundfile', version='0.11.1', @@ -124,18 +120,6 @@ def get_tag(self): 'Topic :: Multimedia :: Sound/Audio', ], long_description=open('README.rst').read(), - ext_modules=[ - Extension("MyExtension", - sources=[ - '...', - ], - include_dirs=[ - os.path.join(os.getcwd(), 'include'), - ], - library_dirs = [os.getcwd(),], # path to .a or .so file(s) - extra_compile_args=extra_compile_args, - ), - ], long_description_content_type="text/x-rst", tests_require=['pytest'], cmdclass=cmdclass, From c9b937d5883da8976d7d82748d5e500602f4163d Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Wed, 3 Aug 2022 23:22:20 -0400 Subject: [PATCH 21/43] Update soundfile_build.py --- soundfile_build.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/soundfile_build.py b/soundfile_build.py index 7282a74..eef2efc 100644 --- a/soundfile_build.py +++ b/soundfile_build.py @@ -2,13 +2,21 @@ import sys from cffi import FFI platform = os.environ.get('PYSOUNDFILE_PLATFORM', sys.platform) -print(platform) +print("Platform:", platform) ffibuilder = FFI() +import sysconfig +try: + extra_includes = sysconfig.get_config_var('CFLAGS').split() +except: + extra_includes = [] +print("CFLAGS: ", extra_includes) ffibuilder.set_source('_soundfile', ''' #include -''', libraries=['sndfile']) +''', + libraries=['sndfile'], + include_dirs = extra_includes) ffibuilder.cdef(""" enum From 0cb963fbc8a649f265ebbb9d4c9d375a0b9c0295 Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Wed, 3 Aug 2022 23:23:30 -0400 Subject: [PATCH 22/43] Update windows.yaml --- .github/workflows/windows.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml index 1b3146d..d0cd8f2 100644 --- a/.github/workflows/windows.yaml +++ b/.github/workflows/windows.yaml @@ -43,7 +43,7 @@ jobs: $Env:windir refreshenv vswhere.exe -latest -property installationPath - Set-Item -Path Env:CFLAGS -Value "-IC:\libsndfile\include" + Set-Item -Path Env:CFLAGS -Value "C:\libsndfile\include" # $Env:INCLUDE # $Env:LIB # $Env:PATH From 75090f3ff1139323f0457435b4c759e8f9367c1d Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Sun, 21 Aug 2022 14:10:13 -0600 Subject: [PATCH 23/43] Update soundfile_build.py Adding includes manually --- soundfile_build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soundfile_build.py b/soundfile_build.py index eef2efc..772dd37 100644 --- a/soundfile_build.py +++ b/soundfile_build.py @@ -9,7 +9,7 @@ try: extra_includes = sysconfig.get_config_var('CFLAGS').split() except: - extra_includes = [] + extra_includes = ["C:\libsndfile\include"] print("CFLAGS: ", extra_includes) ffibuilder.set_source('_soundfile', ''' From 821468f9ebd4d2296627cae6cdec29794e27efc0 Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Sun, 21 Aug 2022 14:34:08 -0600 Subject: [PATCH 24/43] Printing libsndfile --- .github/workflows/windows.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml index d0cd8f2..7cbb39c 100644 --- a/.github/workflows/windows.yaml +++ b/.github/workflows/windows.yaml @@ -43,7 +43,10 @@ jobs: $Env:windir refreshenv vswhere.exe -latest -property installationPath - Set-Item -Path Env:CFLAGS -Value "C:\libsndfile\include" + Get-ChildItem C:\libsndfile\ + +# $Env:PATH +#Set-Item -Path Env:CFLAGS -Value "C:\libsndfile\include" # $Env:INCLUDE # $Env:LIB # $Env:PATH From 7c2304db6b3178b2c03f517ee5d6f30bbea9d6b9 Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Sun, 21 Aug 2022 14:34:23 -0600 Subject: [PATCH 25/43] Update soundfile_build.py Adding library dirs manually --- soundfile_build.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/soundfile_build.py b/soundfile_build.py index 772dd37..70a5144 100644 --- a/soundfile_build.py +++ b/soundfile_build.py @@ -7,16 +7,19 @@ ffibuilder = FFI() import sysconfig try: - extra_includes = sysconfig.get_config_var('CFLAGS').split() + extra_libs = sysconfig.get_config_var('LIB').split() + extra_includes = sysconfig.get_config_var('INCLUDE').split() except: extra_includes = ["C:\libsndfile\include"] -print("CFLAGS: ", extra_includes) + extra_libs = ["C:\libsndfile\bin"] +print("$INCLUDE: ", extra_includes) +print("$LIB: ", extra_libs) -ffibuilder.set_source('_soundfile', ''' -#include -''', +ffibuilder.set_source('_soundfile', + ''' #include ''', libraries=['sndfile'], - include_dirs = extra_includes) + include_dirs = extra_includes. + library_dirs=extra_libs) ffibuilder.cdef(""" enum From eb8bd921e278b8351b2ee80ae2901efcbf830b7a Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Sun, 21 Aug 2022 14:37:21 -0600 Subject: [PATCH 26/43] Update soundfile_build.py typo --- soundfile_build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soundfile_build.py b/soundfile_build.py index 70a5144..2d86f2f 100644 --- a/soundfile_build.py +++ b/soundfile_build.py @@ -18,7 +18,7 @@ ffibuilder.set_source('_soundfile', ''' #include ''', libraries=['sndfile'], - include_dirs = extra_includes. + include_dirs = extra_includes, library_dirs=extra_libs) ffibuilder.cdef(""" From 57922c90d58573ffcb7ed1bad0d9ff8d389bc3ea Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Sun, 21 Aug 2022 14:41:26 -0600 Subject: [PATCH 27/43] Create list_win_paths.yaml --- .github/workflows/list_win_paths.yaml | 48 +++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/list_win_paths.yaml diff --git a/.github/workflows/list_win_paths.yaml b/.github/workflows/list_win_paths.yaml new file mode 100644 index 0000000..f1e633f --- /dev/null +++ b/.github/workflows/list_win_paths.yaml @@ -0,0 +1,48 @@ +# This is a basic workflow to help you get started with Actions +name: CI +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the "master" branch + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# name: Python Package + +# on: [push, pull_request] + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [windows-2019] + python-version: + - "3.6" + - "3.7" + - "3.8" + - "3.9" + - "3.10" + - "pypy-3.7" + - "pypy-3.8" + architecture: ["x86", "x64"] + + steps: + - name: Build on Windows + if: runner.os == 'Windows' + run: | + choco install libsndfile + New-Item -ItemType Junction -Path "C:\libsndfile" -Target "C:\Program Files\libsndfile" + Set-Item -Path Env:LIB -Value "-LC:\libsndfile\bin" + Set-Item -Path Env:INCLUDE -Value "-IC:\libsndfile\include" + $Env:windir + refreshenv + vswhere.exe -latest -property installationPath + Get-ChildItem C:\libsndfile\ + Get-ChildItem C:\libsndfile\bin + Get-ChildItem C:\libsndfile\lib From 17abe6112a45dd406ebc76856c5aba4518ebc963 Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Sun, 21 Aug 2022 14:44:33 -0600 Subject: [PATCH 28/43] Update soundfile_build.py --- soundfile_build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soundfile_build.py b/soundfile_build.py index 2d86f2f..f04b0b7 100644 --- a/soundfile_build.py +++ b/soundfile_build.py @@ -11,7 +11,7 @@ extra_includes = sysconfig.get_config_var('INCLUDE').split() except: extra_includes = ["C:\libsndfile\include"] - extra_libs = ["C:\libsndfile\bin"] + extra_libs = ["C:\libsndfile\lib"] print("$INCLUDE: ", extra_includes) print("$LIB: ", extra_libs) From 7b7a54d254813239c213f6452ab6775c511147a6 Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Sun, 21 Aug 2022 14:47:57 -0600 Subject: [PATCH 29/43] Delete list_win_paths.yaml --- .github/workflows/list_win_paths.yaml | 48 --------------------------- 1 file changed, 48 deletions(-) delete mode 100644 .github/workflows/list_win_paths.yaml diff --git a/.github/workflows/list_win_paths.yaml b/.github/workflows/list_win_paths.yaml deleted file mode 100644 index f1e633f..0000000 --- a/.github/workflows/list_win_paths.yaml +++ /dev/null @@ -1,48 +0,0 @@ -# This is a basic workflow to help you get started with Actions -name: CI -# Controls when the workflow will run -on: - # Triggers the workflow on push or pull request events but only for the "master" branch - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# name: Python Package - -# on: [push, pull_request] - -jobs: - test: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [windows-2019] - python-version: - - "3.6" - - "3.7" - - "3.8" - - "3.9" - - "3.10" - - "pypy-3.7" - - "pypy-3.8" - architecture: ["x86", "x64"] - - steps: - - name: Build on Windows - if: runner.os == 'Windows' - run: | - choco install libsndfile - New-Item -ItemType Junction -Path "C:\libsndfile" -Target "C:\Program Files\libsndfile" - Set-Item -Path Env:LIB -Value "-LC:\libsndfile\bin" - Set-Item -Path Env:INCLUDE -Value "-IC:\libsndfile\include" - $Env:windir - refreshenv - vswhere.exe -latest -property installationPath - Get-ChildItem C:\libsndfile\ - Get-ChildItem C:\libsndfile\bin - Get-ChildItem C:\libsndfile\lib From 1b2a8a540aee0974334e7caf411d49dbd67499f3 Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Sun, 21 Aug 2022 14:48:21 -0600 Subject: [PATCH 30/43] Update windows.yaml --- .github/workflows/windows.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml index 7cbb39c..4950c4d 100644 --- a/.github/workflows/windows.yaml +++ b/.github/workflows/windows.yaml @@ -1,5 +1,5 @@ # This is a basic workflow to help you get started with Actions -name: CI +name: Windows Build # Controls when the workflow will run on: # Triggers the workflow on push or pull request events but only for the "master" branch @@ -43,7 +43,7 @@ jobs: $Env:windir refreshenv vswhere.exe -latest -property installationPath - Get-ChildItem C:\libsndfile\ + Get-ChildItem C:\libsndfile\lib # $Env:PATH #Set-Item -Path Env:CFLAGS -Value "C:\libsndfile\include" From 57aed4fe5e45cd7779b7d88bb34d80659637879e Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Sun, 21 Aug 2022 14:51:50 -0600 Subject: [PATCH 31/43] Update soundfile_build.py --- soundfile_build.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/soundfile_build.py b/soundfile_build.py index f04b0b7..566594e 100644 --- a/soundfile_build.py +++ b/soundfile_build.py @@ -16,7 +16,8 @@ print("$LIB: ", extra_libs) ffibuilder.set_source('_soundfile', - ''' #include ''', + ''' #include + ''', libraries=['sndfile'], include_dirs = extra_includes, library_dirs=extra_libs) From 67aa8bda61f7b11c3708dd6ea0dff82b2fd7e533 Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Sun, 21 Aug 2022 15:00:00 -0600 Subject: [PATCH 32/43] Create workflowslist_win_paths.yml --- .github/workflowslist_win_paths.yml | 42 +++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflowslist_win_paths.yml diff --git a/.github/workflowslist_win_paths.yml b/.github/workflowslist_win_paths.yml new file mode 100644 index 0000000..220f9b8 --- /dev/null +++ b/.github/workflowslist_win_paths.yml @@ -0,0 +1,42 @@ +# This is a basic workflow to help you get started with Actions +name: Windows Paths +# Controls when the workflow will run +on: + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# name: Windows paths + +# on: [push, pull_request] + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [windows-2019] + python-version: + - "3.6" + - "3.7" + - "3.8" + - "3.9" + - "3.10" + - "pypy-3.7" + - "pypy-3.8" + architecture: ["x86", "x64"] + + steps: + - name: Build on Windows + if: runner.os == 'Windows' + run: | + choco install libsndfile + New-Item -ItemType Junction -Path "C:\libsndfile" -Target "C:\Program Files\libsndfile" + Set-Item -Path Env:LIB -Value "-LC:\libsndfile\bin" + Set-Item -Path Env:INCLUDE -Value "-IC:\libsndfile\include" + $Env:windir + refreshenv + vswhere.exe -latest -property installationPath + Get-ChildItem C:\libsndfile\lib + Get-ChildItem C:\libsndfile\bin + Get-ChildItem C:\libsndfile\include From 4db481ef62522c58b7bc268a1f9a55df5b4f3b16 Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Sun, 21 Aug 2022 15:01:03 -0600 Subject: [PATCH 33/43] Update and rename workflowslist_win_paths.yml to list_win_paths.yml --- .../{workflowslist_win_paths.yml => list_win_paths.yml} | 8 -------- 1 file changed, 8 deletions(-) rename .github/{workflowslist_win_paths.yml => list_win_paths.yml} (84%) diff --git a/.github/workflowslist_win_paths.yml b/.github/list_win_paths.yml similarity index 84% rename from .github/workflowslist_win_paths.yml rename to .github/list_win_paths.yml index 220f9b8..2882530 100644 --- a/.github/workflowslist_win_paths.yml +++ b/.github/list_win_paths.yml @@ -1,13 +1,5 @@ # This is a basic workflow to help you get started with Actions name: Windows Paths -# Controls when the workflow will run -on: - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# name: Windows paths - -# on: [push, pull_request] jobs: test: From 68ea8f11334645ee56ba127838d8bece139053d1 Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Sun, 21 Aug 2022 15:02:31 -0600 Subject: [PATCH 34/43] Rename .github/list_win_paths.yml to .github/workflows/list_win_paths.yml --- .github/{ => workflows}/list_win_paths.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{ => workflows}/list_win_paths.yml (100%) diff --git a/.github/list_win_paths.yml b/.github/workflows/list_win_paths.yml similarity index 100% rename from .github/list_win_paths.yml rename to .github/workflows/list_win_paths.yml From a6bf8fff9c32c0c04de05c2ddff29f8716641996 Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Sun, 21 Aug 2022 15:06:01 -0600 Subject: [PATCH 35/43] Delete python-package.yml --- .github/workflows/python-package.yml | 45 ---------------------------- 1 file changed, 45 deletions(-) delete mode 100644 .github/workflows/python-package.yml diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml deleted file mode 100644 index edc399a..0000000 --- a/.github/workflows/python-package.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Python Package - -on: [push, pull_request] - -jobs: - test: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-20.04, windows-2019, macos-10.15] - python-version: - - "3.6" - - "3.7" - - "3.8" - - "3.9" - - "3.10" - - "pypy-3.7" - - "pypy-3.8" - architecture: ["x86", "x64"] - exclude: - - os: macos-10.15 # Can't compile Numpy for this implementation. - python-version: "pypy-3.7" - - os: macos-10.15 - architecture: "x86" - - os: ubuntu-20.04 - architecture: "x86" - - steps: - - name: Install APT dependencies - if: runner.os == 'Linux' - run: sudo apt-get install libsndfile1 - - uses: actions/checkout@v2 - with: - submodules: true - - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - architecture: ${{ matrix.architecture }} - - name: Install requirements - run: pip install numpy pytest - - name: Install editable package - run: pip install --editable . --verbose - - name: Run tests - run: python -m pytest From 778dd01278e1159659065eb05e0c10f2ced661fb Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Sun, 21 Aug 2022 15:06:34 -0600 Subject: [PATCH 36/43] Update list_win_paths.yml --- .github/workflows/list_win_paths.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/list_win_paths.yml b/.github/workflows/list_win_paths.yml index 2882530..4bea188 100644 --- a/.github/workflows/list_win_paths.yml +++ b/.github/workflows/list_win_paths.yml @@ -1,5 +1,7 @@ # This is a basic workflow to help you get started with Actions name: Windows Paths +on: + workflow_dispatch: jobs: test: From 3bdd158a3c80913055eb4d62f686b8dc9ffd6b19 Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Sun, 21 Aug 2022 15:29:11 -0600 Subject: [PATCH 37/43] Update list_win_paths.yml --- .github/workflows/list_win_paths.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/list_win_paths.yml b/.github/workflows/list_win_paths.yml index 4bea188..8f8f822 100644 --- a/.github/workflows/list_win_paths.yml +++ b/.github/workflows/list_win_paths.yml @@ -34,3 +34,8 @@ jobs: Get-ChildItem C:\libsndfile\lib Get-ChildItem C:\libsndfile\bin Get-ChildItem C:\libsndfile\include + - name: vcpkg build + uses: johnwason/vcpkg-action@v2 + with: + pkgs: libsndfile + triplet: x64-windows-release From 09ba166b98ca39db420c8e93020142bc233c78da Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Sun, 21 Aug 2022 15:36:28 -0600 Subject: [PATCH 38/43] Update list_win_paths.yml --- .github/workflows/list_win_paths.yml | 38 +++++++++++++++++++--------- 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/.github/workflows/list_win_paths.yml b/.github/workflows/list_win_paths.yml index 8f8f822..4209c87 100644 --- a/.github/workflows/list_win_paths.yml +++ b/.github/workflows/list_win_paths.yml @@ -23,19 +23,33 @@ jobs: steps: - name: Build on Windows if: runner.os == 'Windows' - run: | - choco install libsndfile - New-Item -ItemType Junction -Path "C:\libsndfile" -Target "C:\Program Files\libsndfile" - Set-Item -Path Env:LIB -Value "-LC:\libsndfile\bin" - Set-Item -Path Env:INCLUDE -Value "-IC:\libsndfile\include" - $Env:windir - refreshenv - vswhere.exe -latest -property installationPath - Get-ChildItem C:\libsndfile\lib - Get-ChildItem C:\libsndfile\bin - Get-ChildItem C:\libsndfile\include - - name: vcpkg build +# run: | +# choco install libsndfile +# New-Item -ItemType Junction -Path "C:\libsndfile" -Target "C:\Program Files\libsndfile" +# Set-Item -Path Env:LIB -Value "-LC:\libsndfile\bin" +# Set-Item -Path Env:INCLUDE -Value "-IC:\libsndfile\include" +# $Env:windir +# refreshenv +# vswhere.exe -latest -property installationPath +# Get-ChildItem C:\libsndfile\lib +# Get-ChildItem C:\libsndfile\bin +# Get-ChildItem C:\libsndfile\include +# - name: vcpkg build uses: johnwason/vcpkg-action@v2 with: pkgs: libsndfile triplet: x64-windows-release + + - uses: actions/checkout@v2 + with: + submodules: true + - uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + architecture: ${{ matrix.architecture }} + - name: Install requirements + run: pip install numpy pytest cffi + - name: Install editable package + run: pip install --editable . --verbose + - name: Run tests + run: python -m pytest From a7581e63934a6df41331d22d8dc42d6835acb903 Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Sun, 21 Aug 2022 15:40:51 -0600 Subject: [PATCH 39/43] Update list_win_paths.yml --- .github/workflows/list_win_paths.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/list_win_paths.yml b/.github/workflows/list_win_paths.yml index 4209c87..08f7c46 100644 --- a/.github/workflows/list_win_paths.yml +++ b/.github/workflows/list_win_paths.yml @@ -38,7 +38,7 @@ jobs: uses: johnwason/vcpkg-action@v2 with: pkgs: libsndfile - triplet: x64-windows-release + triplet: x64-windows-static - uses: actions/checkout@v2 with: From e11c7a570bd2c618df95f082a6f0670029ffb451 Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Sun, 21 Aug 2022 15:54:33 -0600 Subject: [PATCH 40/43] Update list_win_paths.yml --- .github/workflows/list_win_paths.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/list_win_paths.yml b/.github/workflows/list_win_paths.yml index 08f7c46..c071b81 100644 --- a/.github/workflows/list_win_paths.yml +++ b/.github/workflows/list_win_paths.yml @@ -35,11 +35,15 @@ jobs: # Get-ChildItem C:\libsndfile\bin # Get-ChildItem C:\libsndfile\include # - name: vcpkg build - uses: johnwason/vcpkg-action@v2 - with: - pkgs: libsndfile - triplet: x64-windows-static +# uses: johnwason/vcpkg-action@v2 +# with: +# pkgs: libsndfile +# triplet: x64-windows-static + run: | + bootstrap-vcpkg + vcpkg install libsndfile + vcpkg integrate install - uses: actions/checkout@v2 with: submodules: true From 8282703cece6d894ad30b8b3b4cad08b922ac005 Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Sun, 21 Aug 2022 16:04:24 -0600 Subject: [PATCH 41/43] Update list_win_paths.yml --- .github/workflows/list_win_paths.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/list_win_paths.yml b/.github/workflows/list_win_paths.yml index c071b81..8dcf632 100644 --- a/.github/workflows/list_win_paths.yml +++ b/.github/workflows/list_win_paths.yml @@ -21,6 +21,17 @@ jobs: architecture: ["x86", "x64"] steps: + - name: install with choco + if: runner.os == 'Windows' + run: | + choco install libsndfile + New-Item -ItemType Junction -Path "C:\libsndfile" -Target "C:\Program Files\libsndfile" + Set-Item -Path Env:LIB -Value "-LC:\libsndfile\bin" + Set-Item -Path Env:INCLUDE -Value "-IC:\libsndfile\include" + $Env:windir + refreshenv + vswhere.exe -latest -property installationPath + Get-ChildItem C:\libsndfile\lib - name: Build on Windows if: runner.os == 'Windows' # run: | From 35e9095d296eaa6dec24dc0f346b1eaa3f491d4b Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Sun, 21 Aug 2022 17:25:36 -0600 Subject: [PATCH 42/43] Update soundfile_build.py --- soundfile_build.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/soundfile_build.py b/soundfile_build.py index 566594e..4814333 100644 --- a/soundfile_build.py +++ b/soundfile_build.py @@ -10,8 +10,8 @@ extra_libs = sysconfig.get_config_var('LIB').split() extra_includes = sysconfig.get_config_var('INCLUDE').split() except: - extra_includes = ["C:\libsndfile\include"] - extra_libs = ["C:\libsndfile\lib"] + extra_includes = [r"C:vcpkg\packages\libsndfile_x86-windows\include"] + extra_libs = [r"C:vcpkg\packages\libsndfile_x86-windows\lib"] print("$INCLUDE: ", extra_includes) print("$LIB: ", extra_libs) From 68a9ff697d1bb7bfa5e4aab9867739d193bfcc1c Mon Sep 17 00:00:00 2001 From: Ayoub Ghriss Date: Sun, 21 Aug 2022 17:27:47 -0600 Subject: [PATCH 43/43] Update list_win_paths.yml --- .github/workflows/list_win_paths.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/.github/workflows/list_win_paths.yml b/.github/workflows/list_win_paths.yml index 8dcf632..c071b81 100644 --- a/.github/workflows/list_win_paths.yml +++ b/.github/workflows/list_win_paths.yml @@ -21,17 +21,6 @@ jobs: architecture: ["x86", "x64"] steps: - - name: install with choco - if: runner.os == 'Windows' - run: | - choco install libsndfile - New-Item -ItemType Junction -Path "C:\libsndfile" -Target "C:\Program Files\libsndfile" - Set-Item -Path Env:LIB -Value "-LC:\libsndfile\bin" - Set-Item -Path Env:INCLUDE -Value "-IC:\libsndfile\include" - $Env:windir - refreshenv - vswhere.exe -latest -property installationPath - Get-ChildItem C:\libsndfile\lib - name: Build on Windows if: runner.os == 'Windows' # run: |