pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/www



Module Name:    pkgsrc
Committed By:   wiz
Date:           Tue Dec  6 08:54:23 UTC 2022

Modified Files:
        pkgsrc/www/unit: distinfo
        pkgsrc/www/unit-python: Makefile
Added Files:
        pkgsrc/www/unit/patches: patch-src_python_nxt__python.c

Log Message:
unit-python: add Python 3.11 support using upstream patch

Bump PKGREVISION.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 pkgsrc/www/unit/distinfo
cvs rdiff -u -r1.5 -r1.6 pkgsrc/www/unit-python/Makefile
cvs rdiff -u -r0 -r1.1 pkgsrc/www/unit/patches/patch-src_python_nxt__python.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/www/unit/distinfo
diff -u pkgsrc/www/unit/distinfo:1.10 pkgsrc/www/unit/distinfo:1.11
--- pkgsrc/www/unit/distinfo:1.10       Wed Sep 14 05:31:41 2022
+++ pkgsrc/www/unit/distinfo    Tue Dec  6 08:54:23 2022
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.10 2022/09/14 05:31:41 osa Exp $
+$NetBSD: distinfo,v 1.11 2022/12/06 08:54:23 wiz Exp $
 
 BLAKE2s (unit-1.28.0.tar.gz) = fe95e41bc6876ae30070ef0a1cba33181df6813bc69d3a246c71c25ff6193d2a
 SHA512 (unit-1.28.0.tar.gz) = 7d2033be3d8e9d15db21b5431348be73a10fbc19bcab7e83d3c5a770e11e23a53967afe051ec53e236896ac9e021d9146501bc32b87254f9b25778b4bc5d1cbe
@@ -10,3 +10,4 @@ SHA1 (patch-src_nxt__kqueue__engine.c) =
 SHA1 (patch-src_nxt__php__sapi.c) = 2d5e557ff2066bec78f5bfbca6a64688f60da01b
 SHA1 (patch-src_nxt__unix.h) = c0db5bc4d9c45a3ead48627567284d8b3041b0a0
 SHA1 (patch-src_nxt__websocket__header.h) = 1b50405b187cc8a662372a1c20ab7737278135ae
+SHA1 (patch-src_python_nxt__python.c) = 18b638d2e2f155e7f2839309552d34772f0f5162

Index: pkgsrc/www/unit-python/Makefile
diff -u pkgsrc/www/unit-python/Makefile:1.5 pkgsrc/www/unit-python/Makefile:1.6
--- pkgsrc/www/unit-python/Makefile:1.5 Tue Nov 15 12:47:59 2022
+++ pkgsrc/www/unit-python/Makefile     Tue Dec  6 08:54:23 2022
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.5 2022/11/15 12:47:59 wiz Exp $
+# $NetBSD: Makefile,v 1.6 2022/12/06 08:54:23 wiz Exp $
 
 PKGNAME=       unit-${LANG}${PYVERSSUFFIX}-${UNIT_VERSION}
+PKGREVISION=   1
 COMMENT=       Python module for NGINX Unit
 
 LANG=          python
@@ -8,9 +9,6 @@ MODNAME=        ${LANG}
 
 MAINTAINER=    osa%NetBSD.org@localhost
 
-# https://github.com/nginx/unit/issues/710
-PYTHON_VERSIONS_INCOMPATIBLE=  311
-
 post-configure:
        ${RUN} cd ${WRKSRC} && ${SETENV} ${_CONFIGURE_SCRIPT_ENV}               \
                ${CONFIG_SHELL} ${CONFIG_SHELL_FLAGS} ${CONFIGURE_SCRIPT}       \

Added files:

Index: pkgsrc/www/unit/patches/patch-src_python_nxt__python.c
diff -u /dev/null pkgsrc/www/unit/patches/patch-src_python_nxt__python.c:1.1
--- /dev/null   Tue Dec  6 08:54:23 2022
+++ pkgsrc/www/unit/patches/patch-src_python_nxt__python.c      Tue Dec  6 08:54:23 2022
@@ -0,0 +1,100 @@
+$NetBSD: patch-src_python_nxt__python.c,v 1.1 2022/12/06 08:54:23 wiz Exp $
+
+Python 3.11 support.
+https://github.com/nginx/unit/commit/491d0f700f5690eba0f1fcf2124f3a37ef73eb1a
+
+--- src/python/nxt_python.c.orig       2022-09-12 23:26:26.000000000 +0000
++++ src/python/nxt_python.c
+@@ -22,6 +22,10 @@ typedef struct {
+ } nxt_py_thread_info_t;
+ 
+ 
++#if PY_MAJOR_VERSION == 3
++static nxt_int_t nxt_python3_init_config(nxt_int_t pep405);
++#endif
++
+ static nxt_int_t nxt_python_start(nxt_task_t *task,
+     nxt_process_data_t *data);
+ static nxt_int_t nxt_python_set_target(nxt_task_t *task,
+@@ -64,6 +68,63 @@ static nxt_py_thread_info_t  *nxt_py_thr
+ static nxt_python_proto_t    nxt_py_proto;
+ 
+ 
++#if PY_VERSION_HEX >= NXT_PYTHON_VER(3, 8)
++
++static nxt_int_t
++nxt_python3_init_config(nxt_int_t pep405)
++{
++    PyStatus  status;
++    PyConfig  config;
++
++    PyConfig_InitIsolatedConfig(&config);
++
++    if (pep405) {
++        status = PyConfig_SetString(&config, &config.program_name,
++                                    nxt_py_home);
++        if (PyStatus_Exception(status)) {
++            goto pyinit_exception;
++        }
++
++    } else {
++        status =PyConfig_SetString(&config, &config.home, nxt_py_home);
++        if (PyStatus_Exception(status)) {
++            goto pyinit_exception;
++        }
++    }
++
++    status = Py_InitializeFromConfig(&config);
++    if (PyStatus_Exception(status)) {
++        goto pyinit_exception;
++    }
++    PyConfig_Clear(&config);
++
++    return NXT_OK;
++
++pyinit_exception:
++
++    PyConfig_Clear(&config);
++
++    return NXT_ERROR;
++}
++
++#elif PY_MAJOR_VERSION == 3
++
++static nxt_int_t
++nxt_python3_init_config(nxt_int_t pep405)
++{
++    if (pep405) {
++        Py_SetProgramName(nxt_py_home);
++
++    } else {
++        Py_SetPythonHome(nxt_py_home);
++    }
++
++    return NXT_OK;
++}
++
++#endif
++
++
+ static nxt_int_t
+ nxt_python_start(nxt_task_t *task, nxt_process_data_t *data)
+ {
+@@ -127,11 +188,15 @@ nxt_python_start(nxt_task_t *task, nxt_p
+         if (pep405) {
+             mbstowcs(nxt_py_home, c->home, len);
+             mbstowcs(nxt_py_home + len, bin_python, sizeof(bin_python));
+-            Py_SetProgramName(nxt_py_home);
+ 
+         } else {
+             mbstowcs(nxt_py_home, c->home, len + 1);
+-            Py_SetPythonHome(nxt_py_home);
++        }
++
++        ret = nxt_python3_init_config(pep405);
++        if (nxt_slow_path(ret == NXT_ERROR)) {
++            nxt_alert(task, "Failed to initialise config");
++            return NXT_ERROR;
+         }
+ 
+ #else



Home | Main Index | Thread Index | Old Index