From 3f9313102443405c96f66e280313c5e17c49fea2 Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Tue, 25 Jul 2023 17:43:50 +0200 Subject: [PATCH 1/8] core/lock: silence glibc warnings against pthread robust mutex functions Since glibc 2.34 we are gettings warnings that pthread_mutexattr_setrobust_np and pthread_mutex_consistent_np are deprecated. Problem is that we are checking PTHREAD_MUTEX_ROBUST with the preprocessor but it doesn't work because it's an enum :) So in the end we are using the _np versions of the functions even if the standard ones are available. Since this stuff is implemented on linux libc since 2010-2011 and 2016 in freebsd assume it's here. --- core/lock.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/core/lock.c b/core/lock.c index 8e134c6b19..3afe0bee8c 100644 --- a/core/lock.c +++ b/core/lock.c @@ -91,11 +91,6 @@ struct uwsgi_lock_item *uwsgi_lock_fast_init(char *id) { } #ifdef EOWNERDEAD -#ifndef PTHREAD_MUTEX_ROBUST -#define PTHREAD_MUTEX_ROBUST PTHREAD_MUTEX_ROBUST_NP -#define pthread_mutexattr_setrobust pthread_mutexattr_setrobust_np -#define pthread_mutex_consistent pthread_mutex_consistent_np -#endif if (uwsgi_pthread_robust_mutexes_enabled) { int ret; if ((ret = pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT)) != 0) { From d7281596235446efdb53aab5ef5965690f73057b Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Fri, 28 Jul 2023 22:15:17 +0200 Subject: [PATCH 2/8] plugins/jvm: fixup jvm library path detection Fix #2552 --- plugins/jvm/uwsgiplugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/jvm/uwsgiplugin.py b/plugins/jvm/uwsgiplugin.py index 87445ffb5e..23f7da8ff7 100644 --- a/plugins/jvm/uwsgiplugin.py +++ b/plugins/jvm/uwsgiplugin.py @@ -36,7 +36,7 @@ for jvm in known_jvms: if os.path.exists(jvm + '/include'): JVM_INCPATH = ["-I%s/include/" % jvm, "-I%s/include/%s" % (jvm, operating_system)] - if os.path.exists("%s/jre"): + if os.path.exists("%s/jre" % jvm): JVM_LIBPATH = ["-L%s/jre/lib/%s/server" % (jvm, arch)] else: JVM_LIBPATH = ["-L%s/lib/server" % (jvm,)] From b53da59b014a678c3741924fa63870ce8d311ed5 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 4 Sep 2023 13:10:52 +0200 Subject: [PATCH 3/8] plugins/php: ini_entries is read-only PHP 8.3 --- plugins/php/php_plugin.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/plugins/php/php_plugin.c b/plugins/php/php_plugin.c index 4d3930b826..4d9df5eb6d 100644 --- a/plugins/php/php_plugin.c +++ b/plugins/php/php_plugin.c @@ -28,6 +28,7 @@ struct uwsgi_php { char *fallback; char *fallback2; char *fallback_qs; + char *ini_entries; size_t ini_size; int dump_config; char *server_software; @@ -222,21 +223,22 @@ static sapi_module_struct uwsgi_sapi_module; void uwsgi_php_append_config(char *filename) { size_t file_size = 0; - char *file_content = uwsgi_open_and_read(filename, &file_size, 1, NULL); - uwsgi_sapi_module.ini_entries = realloc(uwsgi_sapi_module.ini_entries, uphp.ini_size + file_size); - memcpy(uwsgi_sapi_module.ini_entries + uphp.ini_size, file_content, file_size); + char *file_content = uwsgi_open_and_read(filename, &file_size, 1, NULL); + uphp.ini_entries = realloc(uphp.ini_entries, uphp.ini_size + file_size); + memcpy(uphp.ini_entries + uphp.ini_size, file_content, file_size); uphp.ini_size += file_size-1; free(file_content); + uwsgi_sapi_module.ini_entries = uphp.ini_entries; } void uwsgi_php_set(char *opt) { - uwsgi_sapi_module.ini_entries = realloc(uwsgi_sapi_module.ini_entries, uphp.ini_size + strlen(opt)+2); - memcpy(uwsgi_sapi_module.ini_entries + uphp.ini_size, opt, strlen(opt)); - + uphp.ini_entries = realloc(uphp.ini_entries, uphp.ini_size + strlen(opt)+2); + memcpy(uphp.ini_entries + uphp.ini_size, opt, strlen(opt)); uphp.ini_size += strlen(opt)+1; - uwsgi_sapi_module.ini_entries[uphp.ini_size-1] = '\n'; - uwsgi_sapi_module.ini_entries[uphp.ini_size] = 0; + uphp.ini_entries[uphp.ini_size-1] = '\n'; + uphp.ini_entries[uphp.ini_size] = 0; + uwsgi_sapi_module.ini_entries = uphp.ini_entries; } extern ps_module ps_mod_uwsgi; From 2b9e93c84d1531fac271e4d060896a5237b0e6bc Mon Sep 17 00:00:00 2001 From: Ralf Ertzinger Date: Wed, 19 Jul 2023 19:42:31 +0200 Subject: [PATCH 4/8] plugins/python: add support for Python 3.12 --- .github/workflows/test.yml | 4 +- plugins/python/python_plugin.c | 74 +++++++++++++++++++++++++--------- plugins/python/uwsgi_python.h | 14 ++++++- 3 files changed, 69 insertions(+), 23 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 739bed40d4..009d48438e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - python-version: ["2.7", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"] + python-version: ["2.7", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] test-suite: [unittest, python, deadlocks] steps: - name: Add deadnakes ppa @@ -24,7 +24,7 @@ jobs: libpcre3-dev libjansson-dev libcap2-dev \ curl check - name: Install distutils - if: contains(fromJson('["3.6","3.7","3.8","3.9","3.10","3.11"]'), matrix.python-version) + if: contains(fromJson('["3.6","3.7","3.8","3.9","3.10","3.11","3.12"]'), matrix.python-version) run: | sudo apt install --no-install-recommends -qqyf python${{ matrix.python-version }}-distutils \ - uses: actions/checkout@v2 diff --git a/plugins/python/python_plugin.c b/plugins/python/python_plugin.c index 04cfdb5165..c69abc18b0 100644 --- a/plugins/python/python_plugin.c +++ b/plugins/python/python_plugin.c @@ -197,6 +197,21 @@ void uwsgi_python_pthread_child(void) { PyMethodDef uwsgi_spit_method[] = { {"uwsgi_spit", py_uwsgi_spit, METH_VARARGS, ""} }; PyMethodDef uwsgi_write_method[] = { {"uwsgi_write", py_uwsgi_write, METH_VARARGS, ""} }; +PyDoc_STRVAR(uwsgi_py_doc, "uWSGI api module."); + +#ifdef PYTHREE +static PyModuleDef uwsgi_module3 = { + PyModuleDef_HEAD_INIT, + "uwsgi", + uwsgi_py_doc, + -1, + NULL, +}; +PyObject *init_uwsgi3(void) { + return PyModule_Create(&uwsgi_module3); +} +#endif + int uwsgi_python_init() { char *pyversion = strchr(Py_GetVersion(), '\n'); @@ -261,6 +276,9 @@ int uwsgi_python_init() { wchar_t *pname = uwsgi_calloc(sizeof(wchar_t) * (strlen(program_name)+1)); mbstowcs(pname, program_name, strlen(program_name)+1); Py_SetProgramName(pname); +#ifdef UWSGI_PY312 + PyImport_AppendInittab("uwsgi", init_uwsgi3); +#endif #else Py_SetProgramName(program_name); #endif @@ -623,21 +641,6 @@ void init_uwsgi_vars() { -PyDoc_STRVAR(uwsgi_py_doc, "uWSGI api module."); - -#ifdef PYTHREE -static PyModuleDef uwsgi_module3 = { - PyModuleDef_HEAD_INIT, - "uwsgi", - uwsgi_py_doc, - -1, - NULL, -}; -PyObject *init_uwsgi3(void) { - return PyModule_Create(&uwsgi_module3); -} -#endif - void init_uwsgi_embedded_module() { PyObject *new_uwsgi_module, *zero; int i; @@ -658,7 +661,9 @@ void init_uwsgi_embedded_module() { #ifdef PYTHREE +#ifndef UWSGI_PY312 PyImport_AppendInittab("uwsgi", init_uwsgi3); +#endif new_uwsgi_module = PyImport_AddModule("uwsgi"); #else new_uwsgi_module = Py_InitModule3("uwsgi", NULL, uwsgi_py_doc); @@ -1161,7 +1166,10 @@ void uwsgi_python_init_apps() { // prepare for stack suspend/resume if (uwsgi.async > 1) { -#ifdef UWSGI_PY311 +#ifdef UWSGI_PY312 + up.current_c_recursion_remaining = uwsgi_malloc(sizeof(int)*uwsgi.async); + up.current_py_recursion_remaining = uwsgi_malloc(sizeof(int)*uwsgi.async); +#elif defined UWSGI_PY311 up.current_recursion_remaining = uwsgi_malloc(sizeof(int)*uwsgi.async); #else up.current_recursion_depth = uwsgi_malloc(sizeof(int)*uwsgi.async); @@ -1324,7 +1332,12 @@ void uwsgi_python_pre_uwsgi_fork() { // Acquire the gil and import lock before forking in order to avoid // deadlocks in workers UWSGI_GET_GIL +#if defined UWSGI_PY312 + PyInterpreterState *interp = PyInterpreterState_Get(); + _PyImport_AcquireLock(interp); +#else _PyImport_AcquireLock(); +#endif } } @@ -1336,7 +1349,12 @@ void uwsgi_python_post_uwsgi_fork(int step) { if (uwsgi.has_threads) { if (step == 0) { // Release locks within master process +#if defined UWSGI_PY312 + PyInterpreterState *interp = PyInterpreterState_Get(); + _PyImport_ReleaseLock(interp); +#else _PyImport_ReleaseLock(); +#endif UWSGI_RELEASE_GIL } else { @@ -1592,7 +1610,11 @@ void uwsgi_python_suspend(struct wsgi_request *wsgi_req) { PyGILState_Release(pgst); if (wsgi_req) { -#ifdef UWSGI_PY311 +#ifdef UWSGI_PY312 + up.current_c_recursion_remaining[wsgi_req->async_id] = tstate->c_recursion_remaining; + up.current_py_recursion_remaining[wsgi_req->async_id] = tstate->py_recursion_remaining; + up.current_frame[wsgi_req->async_id] = tstate->cframe; +#elif defined UWSGI_PY311 up.current_recursion_remaining[wsgi_req->async_id] = tstate->recursion_remaining; up.current_frame[wsgi_req->async_id] = tstate->cframe; #else @@ -1601,7 +1623,11 @@ void uwsgi_python_suspend(struct wsgi_request *wsgi_req) { #endif } else { -#ifdef UWSGI_PY311 +#ifdef UWSGI_PY312 + up.current_main_c_recursion_remaining = tstate->c_recursion_remaining; + up.current_main_py_recursion_remaining = tstate->py_recursion_remaining; + up.current_main_frame = tstate->cframe; +#elif defined UWSGI_PY311 up.current_main_recursion_remaining = tstate->recursion_remaining; up.current_main_frame = tstate->cframe; #else @@ -1835,7 +1861,11 @@ void uwsgi_python_resume(struct wsgi_request *wsgi_req) { PyGILState_Release(pgst); if (wsgi_req) { -#ifdef UWSGI_PY311 +#ifdef UWSGI_PY312 + tstate->c_recursion_remaining = up.current_c_recursion_remaining[wsgi_req->async_id]; + tstate->py_recursion_remaining = up.current_py_recursion_remaining[wsgi_req->async_id]; + tstate->cframe = up.current_frame[wsgi_req->async_id]; +#elif defined UWSGI_PY311 tstate->recursion_remaining = up.current_recursion_remaining[wsgi_req->async_id]; tstate->cframe = up.current_frame[wsgi_req->async_id]; #else @@ -1844,7 +1874,11 @@ void uwsgi_python_resume(struct wsgi_request *wsgi_req) { #endif } else { -#ifdef UWSGI_PY311 +#ifdef UWSGI_PY312 + tstate->c_recursion_remaining = up.current_main_c_recursion_remaining; + tstate->py_recursion_remaining = up.current_main_py_recursion_remaining; + tstate->cframe = up.current_main_frame; +#elif defined UWSGI_PY311 tstate->recursion_remaining = up.current_main_recursion_remaining; tstate->cframe = up.current_main_frame; #else diff --git a/plugins/python/uwsgi_python.h b/plugins/python/uwsgi_python.h index fa988439cf..2a45a2b51c 100644 --- a/plugins/python/uwsgi_python.h +++ b/plugins/python/uwsgi_python.h @@ -21,6 +21,10 @@ # define UWSGI_PY311 #endif +#if (PY_VERSION_HEX >= 0x030c0000) +# define UWSGI_PY312 +#endif + #if PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 7 #define HAS_NOT_PyMemoryView_FromBuffer #endif @@ -168,7 +172,15 @@ struct uwsgi_python { char *callable; -#ifdef UWSGI_PY311 +#ifdef UWSGI_PY312 + int *current_c_recursion_remaining; + int *current_py_recursion_remaining; + _PyCFrame **current_frame; + + int current_main_c_recursion_remaining; + int current_main_py_recursion_remaining; + _PyCFrame *current_main_frame; +#elif defined UWSGI_PY311 int *current_recursion_remaining; _PyCFrame **current_frame; From fb2a8931a321ecc041e46e7e4e03a67ff9ce1050 Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Sun, 17 Sep 2023 16:23:17 +0200 Subject: [PATCH 5/8] ci: run compile test on ubuntu 22.04 too --- .github/workflows/compile-test.yml | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/compile-test.yml b/.github/workflows/compile-test.yml index 9d9c564fdc..2a05e3495b 100644 --- a/.github/workflows/compile-test.yml +++ b/.github/workflows/compile-test.yml @@ -8,22 +8,31 @@ on: jobs: build: + strategy: + matrix: + include: + - os: ubuntu-20.04 + php: "php7.4" + php-config: "php-config7.4" + - os: ubuntu-22.04 + php: "php8.1" + php-config: "php-config8.1" - runs-on: ubuntu-20.04 + runs-on: ${{ matrix.os }} steps: - name: remove sury php ppa that does not ship libphpX.Y-embed run: | sudo add-apt-repository --remove ppa:ondrej/php - sudo apt remove php7.4-dev php7.4 php7.4-common + sudo apt remove ${{ matrix.php }}-dev ${{ matrix.php }} ${{ matrix.php }}-common - name: Install dependencies run: | sudo apt update -qq - sudo apt install --no-install-recommends -qqyf python3.8-dev \ + sudo apt install --no-install-recommends -qqyf python3-dev \ libxml2-dev libpcre3-dev libcap2-dev \ libargon2-0-dev libsodium-dev \ - php7.4-dev libphp7.4-embed \ - liblua5.1-0-dev ruby2.7-dev \ + ${{ matrix.php }}-dev lib${{ matrix.php }}-embed \ + liblua5.1-0-dev ruby-dev \ libjansson-dev libldap2-dev libpq-dev \ libpam0g-dev libsqlite3-dev libyaml-dev \ libzmq3-dev libmatheval-dev libperl-dev \ @@ -37,7 +46,7 @@ jobs: curl check - uses: actions/checkout@v2 - name: Build kitchensink uWSGI binary - run: UWSGICONFIG_PHPPATH=php-config7.4 /usr/bin/python3 uwsgiconfig.py --build travis + run: UWSGICONFIG_PHPPATH=${{ matrix.php-config }} /usr/bin/python3 uwsgiconfig.py --build travis - name: Build uWSGI binary run: | /usr/bin/python3 uwsgiconfig.py --build base From 8b83d554ab35e7e98c81342dc891374854af6722 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Wed, 4 Oct 2023 12:36:02 +1100 Subject: [PATCH 6/8] Use sysconfig if distutils is not available distutils have been removed in Python 3.12. Co-authored-by: Steve Kowalik Co-authored-by: Terence D. Honles Co-authored-by: Riccardo Magliocchetti --- plugins/asyncio/uwsgiplugin.py | 18 ++++++++++++--- plugins/gevent/uwsgiplugin.py | 18 ++++++++++++--- plugins/greenlet/uwsgiplugin.py | 18 ++++++++++++--- plugins/python/uwsgiplugin.py | 38 +++++++++++++++++++++++++++----- plugins/pyuwsgi/uwsgiplugin.py | 19 +++++++++++++--- plugins/stackless/uwsgiplugin.py | 18 ++++++++++++--- plugins/tornado/uwsgiplugin.py | 18 ++++++++++++--- setup.cpyext.py | 3 +-- uwsgiconfig.py | 12 ++++------ 9 files changed, 128 insertions(+), 34 deletions(-) diff --git a/plugins/asyncio/uwsgiplugin.py b/plugins/asyncio/uwsgiplugin.py index 0441db410a..a044c1bd3d 100644 --- a/plugins/asyncio/uwsgiplugin.py +++ b/plugins/asyncio/uwsgiplugin.py @@ -1,7 +1,19 @@ -from distutils import sysconfig +try: + from distutils import sysconfig + paths = [ + sysconfig.get_python_inc(), + sysconfig.get_python_inc(plat_specific=True), + ] +except ImportError: + import sysconfig + paths = [ + sysconfig.get_path('include'), + sysconfig.get_path('platinclude'), + ] -NAME='asyncio' -CFLAGS = ['-I' + sysconfig.get_python_inc(), '-I' + sysconfig.get_python_inc(plat_specific=True)] +NAME = 'asyncio' + +CFLAGS = ['-I' + path for path in paths] LDFLAGS = [] LIBS = [] diff --git a/plugins/gevent/uwsgiplugin.py b/plugins/gevent/uwsgiplugin.py index 155e2f234b..422a5ffc19 100644 --- a/plugins/gevent/uwsgiplugin.py +++ b/plugins/gevent/uwsgiplugin.py @@ -1,7 +1,19 @@ -from distutils import sysconfig +try: + from distutils import sysconfig + paths = [ + sysconfig.get_python_inc(), + sysconfig.get_python_inc(plat_specific=True), + ] +except ImportError: + import sysconfig + paths = [ + sysconfig.get_path('include'), + sysconfig.get_path('platinclude'), + ] -NAME='gevent' -CFLAGS = ['-I' + sysconfig.get_python_inc(), '-I' + sysconfig.get_python_inc(plat_specific=True)] +NAME = 'gevent' + +CFLAGS = ['-I' + path for path in paths] LDFLAGS = [] LIBS = [] diff --git a/plugins/greenlet/uwsgiplugin.py b/plugins/greenlet/uwsgiplugin.py index 01fcefbc05..c712b53699 100644 --- a/plugins/greenlet/uwsgiplugin.py +++ b/plugins/greenlet/uwsgiplugin.py @@ -1,7 +1,19 @@ -from distutils import sysconfig +try: + from distutils import sysconfig + paths = [ + sysconfig.get_python_inc(), + sysconfig.get_python_inc(plat_specific=True), + ] +except ImportError: + import sysconfig + paths = [ + sysconfig.get_path('include'), + sysconfig.get_path('platinclude'), + ] -NAME='greenlet' -CFLAGS = ['-I' + sysconfig.get_python_inc(), '-I' + sysconfig.get_python_inc(plat_specific=True)] +NAME = 'greenlet' + +CFLAGS = ['-I' + path for path in paths] LDFLAGS = [] LIBS = [] diff --git a/plugins/python/uwsgiplugin.py b/plugins/python/uwsgiplugin.py index 504d5148cf..b4e20c3e22 100644 --- a/plugins/python/uwsgiplugin.py +++ b/plugins/python/uwsgiplugin.py @@ -1,6 +1,17 @@ -import os,sys - -from distutils import sysconfig +import os +import sys +try: + from distutils import sysconfig + paths = [ + sysconfig.get_python_inc(), + sysconfig.get_python_inc(plat_specific=True), + ] +except ImportError: + import sysconfig + paths = [ + sysconfig.get_path('include'), + sysconfig.get_path('platinclude'), + ] def get_python_version(): version = sysconfig.get_config_var('VERSION') @@ -10,10 +21,25 @@ def get_python_version(): pass return version -NAME='python' -GCC_LIST = ['python_plugin', 'pyutils', 'pyloader', 'wsgi_handlers', 'wsgi_headers', 'wsgi_subhandler', 'web3_subhandler', 'pump_subhandler', 'gil', 'uwsgi_pymodule', 'profiler', 'symimporter', 'tracebacker', 'raw'] +NAME = 'python' +GCC_LIST = [ + 'python_plugin', + 'pyutils', + 'pyloader', + 'wsgi_handlers', + 'wsgi_headers', + 'wsgi_subhandler', + 'web3_subhandler', + 'pump_subhandler', + 'gil', + 'uwsgi_pymodule', + 'profiler', + 'symimporter', + 'tracebacker', + 'raw' +] -CFLAGS = ['-I' + sysconfig.get_python_inc(), '-I' + sysconfig.get_python_inc(plat_specific=True) ] +CFLAGS = ['-I' + path for path in paths] LDFLAGS = [] if not 'UWSGI_PYTHON_NOLIB' in os.environ: diff --git a/plugins/pyuwsgi/uwsgiplugin.py b/plugins/pyuwsgi/uwsgiplugin.py index a74c5a22b6..3b2c7eb625 100644 --- a/plugins/pyuwsgi/uwsgiplugin.py +++ b/plugins/pyuwsgi/uwsgiplugin.py @@ -1,10 +1,23 @@ -from distutils import sysconfig import os +import sys +try: + from distutils import sysconfig + paths = [ + sysconfig.get_python_inc(), + sysconfig.get_python_inc(plat_specific=True), + ] +except ImportError: + import sysconfig + paths = [ + sysconfig.get_path('include'), + sysconfig.get_path('platinclude'), + ] os.environ['UWSGI_PYTHON_NOLIB'] = '1' -NAME='pyuwsgi' -CFLAGS = ['-I' + sysconfig.get_python_inc(), '-I' + sysconfig.get_python_inc(plat_specific=True)] +NAME = 'pyuwsgi' + +CFLAGS = ['-I' + path for path in paths] LDFLAGS = [] LIBS = [] diff --git a/plugins/stackless/uwsgiplugin.py b/plugins/stackless/uwsgiplugin.py index 4c3924a083..a304b97a52 100644 --- a/plugins/stackless/uwsgiplugin.py +++ b/plugins/stackless/uwsgiplugin.py @@ -1,7 +1,19 @@ -from distutils import sysconfig +try: + from distutils import sysconfig + paths = [ + sysconfig.get_python_inc(), + sysconfig.get_python_inc(plat_specific=True), + ] +except ImportError: + import sysconfig + paths = [ + sysconfig.get_path('include'), + sysconfig.get_path('platinclude'), + ] -NAME='stackless' -CFLAGS = ['-I' + sysconfig.get_python_inc(), '-I' + sysconfig.get_python_inc(plat_specific=True)] +NAME = 'stackless' + +CFLAGS = ['-I' + path for path in paths] LDFLAGS = [] LIBS = [] diff --git a/plugins/tornado/uwsgiplugin.py b/plugins/tornado/uwsgiplugin.py index efd9e08ecd..f80b6efbf1 100644 --- a/plugins/tornado/uwsgiplugin.py +++ b/plugins/tornado/uwsgiplugin.py @@ -1,7 +1,19 @@ -from distutils import sysconfig +try: + from distutils import sysconfig + paths = [ + sysconfig.get_python_inc(), + sysconfig.get_python_inc(plat_specific=True), + ] +except ImportError: + import sysconfig + paths = [ + sysconfig.get_path('include'), + sysconfig.get_path('platinclude'), + ] -NAME='tornado' -CFLAGS = ['-I' + sysconfig.get_python_inc(), '-I' + sysconfig.get_python_inc(plat_specific=True)] +NAME = 'tornado' + +CFLAGS = ['-I' + path for path in paths] LDFLAGS = [] LIBS = [] diff --git a/setup.cpyext.py b/setup.cpyext.py index c29b1d3a9a..9a238d7ab0 100644 --- a/setup.cpyext.py +++ b/setup.cpyext.py @@ -12,9 +12,8 @@ import shlex import uwsgiconfig -from setuptools import setup +from setuptools import setup, Extension from setuptools.command.build_ext import build_ext -from distutils.core import Extension class uWSGIBuildExt(build_ext): diff --git a/uwsgiconfig.py b/uwsgiconfig.py index 30e174e1ab..d5ddc3c2fb 100644 --- a/uwsgiconfig.py +++ b/uwsgiconfig.py @@ -12,22 +12,18 @@ import sys import subprocess -from threading import Thread,Lock +import sysconfig +from threading import Thread, Lock from optparse import OptionParser try: from queue import Queue -except: - from Queue import Queue - -try: - import sysconfig except ImportError: - from distutils import sysconfig + from Queue import Queue try: import ConfigParser -except: +except ImportError: import configparser as ConfigParser try: From fb7431208319a54630c24f1e35f117f9f0108273 Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Wed, 1 Nov 2023 14:22:16 +0100 Subject: [PATCH 7/8] Bump version to 2.0.23 --- PKG-INFO | 2 +- uwsgi.gemspec | 2 +- uwsgiconfig.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/PKG-INFO b/PKG-INFO index 5df9cd802e..86ca9ba6d5 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: uWSGI -Version: 2.0.22 +Version: 2.0.23 Summary: The uWSGI server Home-page: https://uwsgi-docs.readthedocs.io/en/latest/ Author: Unbit diff --git a/uwsgi.gemspec b/uwsgi.gemspec index 0744b0c39e..5c7df93b30 100644 --- a/uwsgi.gemspec +++ b/uwsgi.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = 'uwsgi' s.license = 'GPL-2' s.version = `python -c "import uwsgiconfig as uc; print uc.uwsgi_version"`.sub(/-dev-.*/,'') - s.date = '2023-07-27' + s.date = '2023-11-01' s.summary = "uWSGI" s.description = "The uWSGI server for Ruby/Rack" s.authors = ["Unbit"] diff --git a/uwsgiconfig.py b/uwsgiconfig.py index d5ddc3c2fb..968690d395 100644 --- a/uwsgiconfig.py +++ b/uwsgiconfig.py @@ -1,6 +1,6 @@ # uWSGI build system -uwsgi_version = '2.0.22' +uwsgi_version = '2.0.23' import os import re From ed4da624b5a8412b32164f25415aec78af400e15 Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Wed, 1 Nov 2023 14:23:55 +0100 Subject: [PATCH 8/8] Add python trove classifier for 3.12 --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index b44b0a913f..5e226c5958 100644 --- a/setup.py +++ b/setup.py @@ -141,5 +141,6 @@ def is_pure(self): 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', ], )