Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: update cibuildwheel; ensure Python-3.12 builds #116

Merged
merged 4 commits into from
Nov 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
env:
CIBW_SKIP: "*p36-*"
CIBW_SKIP: "*p36-* *p37-*"
CIBW_ARCHS: auto64
CIBW_ARCHS_MACOS: "x86_64 arm64"
steps:
@@ -31,7 +31,7 @@ jobs:
if: ${{ runner.os == 'Linux' }}
run: |
python -m pip install --upgrade pip
pip install pytest Cython wheel
pip install setuptools pytest Cython wheel
- name: sdist (Linux)
if: ${{ runner.os == 'Linux' }}
run: python setup.py sdist
@@ -43,7 +43,7 @@ jobs:
path: dist
retention-days: 5
- name: build binary wheels
uses: pypa/cibuildwheel@v2.12.1
uses: pypa/cibuildwheel@v2.16.2
- name: upload wheels
uses: actions/upload-artifact@v3
with:
21 changes: 16 additions & 5 deletions src/ctypes.pxd
Original file line number Diff line number Diff line change
@@ -11,6 +11,8 @@ from libc.stddef cimport wchar_t
from libcpp.list cimport list
from libcpp.map cimport map
from libcpp.string cimport string
from cpython.mem cimport PyMem_Free
from cpython.object cimport PyObject


cdef extern from 'taglib/tstring.h' namespace 'TagLib::String':
@@ -60,12 +62,21 @@ cdef extern from 'taglib/tfile.h' namespace 'TagLib':
void removeUnsupportedProperties(StringList&)


cdef extern from 'taglib/fileref.h' namespace 'TagLib::FileRef':
IF UNAME_SYSNAME == "Windows":
cdef File* create(const Py_UNICODE*) except +
ELSE:
IF UNAME_SYSNAME == "Windows":
cdef extern from 'taglib/fileref.h' namespace 'TagLib::FileRef':
cdef File * create(const wchar_t *) except +
cdef extern from "Python.h":
cdef wchar_t *PyUnicode_AsWideCharString(PyObject *path, Py_ssize_t *size)
cdef inline File* create_wrapper(unicode path):
cdef wchar_t *wchar_path = PyUnicode_AsWideCharString(<PyObject*>path, NULL)
cdef File * file = create(wchar_path)
PyMem_Free(wchar_path)
return file
ELSE:
cdef extern from 'taglib/fileref.h' namespace 'TagLib::FileRef':
cdef File* create(const char*) except +

cdef inline File* create_wrapper(unicode path):
return create(path.encode('utf-8'))

cdef extern from 'taglib/taglib.h':
int TAGLIB_MAJOR_VERSION
8 changes: 2 additions & 6 deletions src/taglib.pyx
Original file line number Diff line number Diff line change
@@ -40,6 +40,7 @@ cdef dict propertyMapToDict(ctypes.PropertyMap map):
return dct



cdef class File:
"""Class representing an audio file with metadata ("tags").
@@ -80,12 +81,7 @@ cdef class File:
path = path.decode('utf8')
path = Path(path)
self.path = path
IF UNAME_SYSNAME == "Windows":
# create on windows takes wchar_t* which Cython automatically converts to
# from unicode strings
self.cFile = ctypes.create(str(self.path))
ELSE:
self.cFile = ctypes.create(str(self.path).encode('utf8'))
self.cFile = ctypes.create_wrapper(str(self.path))
if not self.cFile or not self.cFile.isValid():
raise OSError(f'Could not read file {path}')