From cba58c273fe9122c4c0b1772e17e6f9a6fc21278 Mon Sep 17 00:00:00 2001 From: synodriver Date: Sat, 3 Feb 2024 21:48:37 +0800 Subject: [PATCH] prepare for m1 --- .github/workflows/build_whl.yml | 10 ++--- .github/workflows/unitest.yml | 8 ++-- .github/workflows/upload.yml | 8 ++-- changename.py | 12 +++++ pysilk/__init__.py | 2 +- pysilk/backends/cython/_silk.c | 79 +++++++++++++++++---------------- setup.py | 3 +- 7 files changed, 68 insertions(+), 54 deletions(-) diff --git a/.github/workflows/build_whl.yml b/.github/workflows/build_whl.yml index 6db7f2c..9844202 100644 --- a/.github/workflows/build_whl.yml +++ b/.github/workflows/build_whl.yml @@ -9,15 +9,15 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "pypy3.7", "pypy3.8"] - os: [ubuntu-latest, macos-latest, windows-latest] + python-version: ["3.8", "3.9", "3.10", "3.11", "pypy3.7", "pypy3.8", "pypy3.9", "pypy3.10"] + os: [ubuntu-22.04, macos-12, macos-14, windows-2019] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Check out recursively run: git submodule update --init --recursive - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -30,7 +30,7 @@ jobs: - name: build_whl run: | python setup.py sdist bdist_wheel --use-cython --use-cffi - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: ${{ matrix.os }}-${{ matrix.python-version }} path: dist/*.whl \ No newline at end of file diff --git a/.github/workflows/unitest.yml b/.github/workflows/unitest.yml index 71f16bd..e01f254 100644 --- a/.github/workflows/unitest.yml +++ b/.github/workflows/unitest.yml @@ -9,16 +9,16 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "pypy3.7", "pypy3.8"] - os: [ubuntu-latest, macos-latest, windows-latest] + python-version: ["3.8", "3.9", "3.10", "3.11", "pypy3.7", "pypy3.8", "pypy3.9", "pypy3.10"] + os: [ubuntu-22.04, macos-12, macos-14, windows-2019] fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Check out recursively run: git submodule update --init --recursive - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies diff --git a/.github/workflows/upload.yml b/.github/workflows/upload.yml index bb7678a..2a8b90b 100644 --- a/.github/workflows/upload.yml +++ b/.github/workflows/upload.yml @@ -9,16 +9,16 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.7", "pypy3.8", "pypy3.9", "pypy3.10"] - os: [ubuntu-latest, macos-latest, windows-latest] + python-version: ["3.8", "3.9", "3.10", "3.11", "pypy3.7", "pypy3.8", "pypy3.9", "pypy3.10"] + os: [ubuntu-22.04, macos-12, macos-14, windows-2019] fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Check out recursively run: git submodule update --init --recursive - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies diff --git a/changename.py b/changename.py index 96a17c2..99af8df 100644 --- a/changename.py +++ b/changename.py @@ -1,4 +1,5 @@ import os +import platform for f in os.listdir("dist"): if "linux" in f: @@ -6,3 +7,14 @@ os.path.join("dist", f), os.path.join("dist", f.replace("linux", "manylinux2014")), ) + elif "macosx" in f: + if platform.machine() == "x86_64": + os.rename( + os.path.join("dist", f), + os.path.join("dist", f.replace("universal2", "x86_64")), + ) + else: + os.rename( + os.path.join("dist", f), + os.path.join("dist", f.replace("universal2", "arm64")), + ) diff --git a/pysilk/__init__.py b/pysilk/__init__.py index 474884f..2782208 100644 --- a/pysilk/__init__.py +++ b/pysilk/__init__.py @@ -19,4 +19,4 @@ def _should_use_cffi() -> bool: else: from pysilk.backends.cffi import * -__version__ = "0.2.4" +__version__ = "0.2.5" diff --git a/pysilk/backends/cython/_silk.c b/pysilk/backends/cython/_silk.c index 37f840d..2aa2bf4 100644 --- a/pysilk/backends/cython/_silk.c +++ b/pysilk/backends/cython/_silk.c @@ -1,4 +1,4 @@ -/* Generated by Cython 3.0.6 */ +/* Generated by Cython 3.0.8 */ /* BEGIN: Cython Metadata { @@ -153,10 +153,10 @@ END: Cython Metadata */ #else #define __PYX_EXTRA_ABI_MODULE_NAME "" #endif -#define CYTHON_ABI "3_0_6" __PYX_EXTRA_ABI_MODULE_NAME +#define CYTHON_ABI "3_0_8" __PYX_EXTRA_ABI_MODULE_NAME #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." -#define CYTHON_HEX_VERSION 0x030006F0 +#define CYTHON_HEX_VERSION 0x030008F0 #define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof @@ -698,14 +698,14 @@ END: Cython Metadata */ PyObject *exception_table = NULL; PyObject *types_module=NULL, *code_type=NULL, *result=NULL; #if __PYX_LIMITED_VERSION_HEX < 0x030B0000 - PyObject *version_info; // borrowed + PyObject *version_info; PyObject *py_minor_version = NULL; #endif long minor_version = 0; PyObject *type, *value, *traceback; PyErr_Fetch(&type, &value, &traceback); #if __PYX_LIMITED_VERSION_HEX >= 0x030B0000 - minor_version = 11; // we don't yet need to distinguish between versions > 11 + minor_version = 11; #else if (!(version_info = PySys_GetObject("version_info"))) goto end; if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end; @@ -763,7 +763,7 @@ END: Cython Metadata */ PyObject *fv, PyObject *cell, PyObject* fn, PyObject *name, int fline, PyObject *lnos) { PyCodeObject *result; - PyObject *empty_bytes = PyBytes_FromStringAndSize("", 0); // we don't have access to __pyx_empty_bytes here + PyObject *empty_bytes = PyBytes_FromStringAndSize("", 0); if (!empty_bytes) return NULL; result = #if PY_VERSION_HEX >= 0x030C0000 @@ -1490,7 +1490,7 @@ static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); #endif typedef Py_ssize_t __Pyx_compact_pylong; typedef size_t __Pyx_compact_upylong; - #else // Py < 3.12 + #else #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) @@ -1803,8 +1803,8 @@ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int #define __Pyx_Arg_NewRef_VARARGS(arg) __Pyx_NewRef(arg) #define __Pyx_Arg_XDECREF_VARARGS(arg) Py_XDECREF(arg) #else - #define __Pyx_Arg_NewRef_VARARGS(arg) arg // no-op - #define __Pyx_Arg_XDECREF_VARARGS(arg) // no-op - arg is borrowed + #define __Pyx_Arg_NewRef_VARARGS(arg) arg + #define __Pyx_Arg_XDECREF_VARARGS(arg) #endif #define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds) #define __Pyx_KwValues_VARARGS(args, nargs) NULL @@ -1820,8 +1820,9 @@ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int #else #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) #endif - #define __Pyx_Arg_NewRef_FASTCALL(arg) arg // no-op, __Pyx_Arg_FASTCALL is direct and this needs - #define __Pyx_Arg_XDECREF_FASTCALL(arg) // no-op - arg was returned from array + #define __Pyx_Arg_NewRef_FASTCALL(arg) arg /* no-op, __Pyx_Arg_FASTCALL is direct and this needs + to have the same reference counting */ + #define __Pyx_Arg_XDECREF_FASTCALL(arg) #else #define __Pyx_Arg_FASTCALL __Pyx_Arg_VARARGS #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS @@ -2052,22 +2053,22 @@ static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject #endif /* TypeImport.proto */ -#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_6 -#define __PYX_HAVE_RT_ImportType_proto_3_0_6 +#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_8 +#define __PYX_HAVE_RT_ImportType_proto_3_0_8 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L #include #endif #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L -#define __PYX_GET_STRUCT_ALIGNMENT_3_0_6(s) alignof(s) +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_8(s) alignof(s) #else -#define __PYX_GET_STRUCT_ALIGNMENT_3_0_6(s) sizeof(void*) +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_8(s) sizeof(void*) #endif -enum __Pyx_ImportType_CheckSize_3_0_6 { - __Pyx_ImportType_CheckSize_Error_3_0_6 = 0, - __Pyx_ImportType_CheckSize_Warn_3_0_6 = 1, - __Pyx_ImportType_CheckSize_Ignore_3_0_6 = 2 +enum __Pyx_ImportType_CheckSize_3_0_8 { + __Pyx_ImportType_CheckSize_Error_3_0_8 = 0, + __Pyx_ImportType_CheckSize_Warn_3_0_8 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_0_8 = 2 }; -static PyTypeObject *__Pyx_ImportType_3_0_6(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_6 check_size); +static PyTypeObject *__Pyx_ImportType_3_0_8(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_8 check_size); #endif /* Py3UpdateBases.proto */ @@ -2174,7 +2175,7 @@ typedef struct { #endif void *defaults; int defaults_pyobjects; - size_t defaults_size; // used by FusedFunction for copying defaults + size_t defaults_size; int flags; PyObject *defaults_tuple; PyObject *defaults_kwdict; @@ -7197,15 +7198,15 @@ static int __Pyx_modinit_type_import_code(void) { /*--- Type import code ---*/ __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_0_6(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_0_8(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 - sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_6(PyTypeObject), + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_8(PyTypeObject), #elif CYTHON_COMPILING_IN_LIMITED_API - sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_6(PyTypeObject), + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_8(PyTypeObject), #else - sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_6(PyHeapTypeObject), + sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_8(PyHeapTypeObject), #endif - __Pyx_ImportType_CheckSize_Warn_3_0_6); if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_ImportType_CheckSize_Warn_3_0_8); if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(1, 9, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; @@ -7425,7 +7426,7 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec__silk(PyObject *__pyx_pyinit_modul __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) { int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef); - __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to _silk pseudovariable */ + __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "_silk" pseudovariable */ if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) pystate_addmodule_run = 1; } @@ -8194,11 +8195,11 @@ static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyO { int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), Py_EQ); if (unlikely(eq != 0)) { - if (unlikely(eq < 0)) return NULL; // error + if (unlikely(eq < 0)) return NULL; return kwvalues[i]; } } - return NULL; // not found (no exception set) + return NULL; } #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) { @@ -8311,7 +8312,7 @@ static int __Pyx_ParseOptionalKeywords( if (*name) { values[name-argnames] = value; #if CYTHON_AVOID_BORROWED_REFS - Py_INCREF(value); // transfer ownership of value to values + Py_INCREF(value); Py_DECREF(key); #endif key = NULL; @@ -8330,7 +8331,7 @@ static int __Pyx_ParseOptionalKeywords( && _PyString_Eq(**name, key)) { values[name-argnames] = value; #if CYTHON_AVOID_BORROWED_REFS - value = NULL; // ownership transferred to values + value = NULL; #endif break; } @@ -8362,7 +8363,7 @@ static int __Pyx_ParseOptionalKeywords( if (cmp == 0) { values[name-argnames] = value; #if CYTHON_AVOID_BORROWED_REFS - value = NULL; // ownership transferred to values + value = NULL; #endif break; } @@ -9327,10 +9328,10 @@ static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject #endif /* TypeImport */ -#ifndef __PYX_HAVE_RT_ImportType_3_0_6 -#define __PYX_HAVE_RT_ImportType_3_0_6 -static PyTypeObject *__Pyx_ImportType_3_0_6(PyObject *module, const char *module_name, const char *class_name, - size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_6 check_size) +#ifndef __PYX_HAVE_RT_ImportType_3_0_8 +#define __PYX_HAVE_RT_ImportType_3_0_8 +static PyTypeObject *__Pyx_ImportType_3_0_8(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_8 check_size) { PyObject *result = 0; char warning[200]; @@ -9384,7 +9385,7 @@ static PyTypeObject *__Pyx_ImportType_3_0_6(PyObject *module, const char *module module_name, class_name, size, basicsize+itemsize); goto bad; } - if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_6 && + if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_8 && ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) { PyErr_Format(PyExc_ValueError, "%.200s.%.200s size changed, may indicate binary incompatibility. " @@ -9392,7 +9393,7 @@ static PyTypeObject *__Pyx_ImportType_3_0_6(PyObject *module, const char *module module_name, class_name, size, basicsize, basicsize+itemsize); goto bad; } - else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_6 && (size_t)basicsize > size) { + else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_8 && (size_t)basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", @@ -11279,7 +11280,7 @@ static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( #else py_code = PyCode_NewEmpty(filename, funcname, py_line); #endif - Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline + Py_XDECREF(py_funcname); return py_code; bad: Py_XDECREF(py_funcname); diff --git a/setup.py b/setup.py index 8425929..621eeec 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ def build_extensions(self): compiler = self.compiler.compiler_type args = BUILD_ARGS[compiler] for ext in self.extensions: - ext.extra_compile_args = args + ext.extra_compile_args.extend(args) super().build_extensions() @@ -125,6 +125,7 @@ def main(): "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", ],