Mercurial > hgrepos > FreeBSD > ports > www > uwsginl
changeset 80:2500587e4a5e
plugins/{pypy,python}: get rid of unnecessary paste.script dependency
paste.script.util.logging_config is an old copy of logging.config from
Python 2.5.1 (see [1]). There are no paste-specific details in it.
By using logging.config directly, Python WSGI environments no longer need to
have pastescript installed.
[1] https://bitbucket.org/wilig/pastescript/commits/04d0db6b2f5ab360bdaa5b10511d969a24fde0ec
commit 71464fbda59c5e3668bcc3fab8c5aa66935cf95c
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Sun, 14 Jun 2020 22:23:07 +0200 |
| parents | badbe8b61265 |
| children | 346c4a4ca40b |
| files | uwsginl/files/patch-plugins_pypy_pypy__setup.py uwsginl/files/patch-plugins_python_pyloader.c |
| diffstat | 2 files changed, 143 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl/files/patch-plugins_pypy_pypy__setup.py Sun Jun 14 22:23:07 2020 +0200 @@ -0,0 +1,132 @@ +--- plugins/pypy/pypy_setup.py.orig 2020-06-14 20:21:12 UTC ++++ plugins/pypy/pypy_setup.py +@@ -53,10 +53,10 @@ for cflag in uwsgi_cflags: + if '=' in line: + (key, value) = line.split('=', 1) + uwsgi_cdef.append('#define %s ...' % key) +- uwsgi_defines.append('#define %s %s' % (key, value.replace('\\"','"').replace('""','"'))) ++ uwsgi_defines.append('#define %s %s' % (key, value.replace('\\"','"').replace('""','"'))) + else: + uwsgi_cdef.append('#define %s ...' % line) +- uwsgi_defines.append('#define %s 1' % line) ++ uwsgi_defines.append('#define %s 1' % line) + uwsgi_dot_h = ffi.string(lib0.uwsgi_get_dot_h()) + + # uwsgi definitions +@@ -148,7 +148,7 @@ struct uwsgi_server { + int master_process; + + struct uwsgi_opt **exported_opts; +- int exported_opts_cnt; ++ int exported_opts_cnt; + + struct uwsgi_worker *workers; + +@@ -160,7 +160,7 @@ struct uwsgi_server { + void (*schedule_to_req) (void); + + struct wsgi_request *(*current_wsgi_req) (void); +- ++ + struct wsgi_request *wsgi_req; + + struct uwsgi_plugin *p[]; +@@ -326,10 +326,10 @@ def uwsgi_pypy_paste_loader(config): + if c[0] != '/': + c = os.getcwd() + '/' + c + try: +- from paste.script.util.logging_config import fileConfig ++ from logging_config import fileConfig + fileConfig(c) + except ImportError: +- print "PyPy WARNING: unable to load paste.script.util.logging_config" ++ print "PyPy WARNING: unable to load logging_config" + from paste.deploy import loadapp + wsgi_application = loadapp('config:%s' % c) + +@@ -572,7 +572,7 @@ def uwsgi_pypy_call(func, *args): + (func, node) = func.split('@') + return uwsgi_pypy_rpc(node, func, *args) + uwsgi.call = uwsgi_pypy_call +- ++ + uwsgi.signal = lambda x: lib.uwsgi_signal_send(lib.uwsgi.signal_socket, x) + + uwsgi.metric_get = lambda x: lib.uwsgi_metric_get(x, ffi.NULL) +@@ -733,16 +733,16 @@ def uwsgi_pypy_workers(): + if lib.uwsgi.workers[i].sig: + worker['status'] = 'sig%d' % lib.uwsgi.workers[i].signum + elif lib.uwsgi_worker_is_busy(i): +- worker['status'] = 'busy' ++ worker['status'] = 'busy' + else: + worker['status'] = 'idle' + worker['running_time'] = lib.uwsgi.workers[i].running_time + worker['avg_rt'] = lib.uwsgi.workers[i].avg_response_time + worker['tx'] = lib.uwsgi.workers[i].tx +- ++ + workers.append(worker) + return workers +- ++ + uwsgi.workers = uwsgi_pypy_workers + + """ +@@ -791,8 +791,8 @@ def uwsgi_pypy_ready_fd(): + wsgi_req = uwsgi_pypy_current_wsgi_req(); + return lib.uwsgi_ready_fd(wsgi_req) + uwsgi.ready_fd = uwsgi_pypy_ready_fd +- + ++ + """ + uwsgi.send(fd=None,data) + """ +@@ -831,7 +831,7 @@ def uwsgi_pypy_recv(*args): + raise IOError("unable to receive data") + return ffi.string(data[0:rlen]) + uwsgi.recv = uwsgi_pypy_recv +- ++ + """ + uwsgi.close(fd) + """ +@@ -949,14 +949,14 @@ def uwsgi_pypy_continulet_schedule(): + + # this is called in the main stack + if lib.uwsgi.p[modifier1].suspend: +- lib.uwsgi.p[modifier1].suspend(ffi.NULL) ++ lib.uwsgi.p[modifier1].suspend(ffi.NULL) + + # let's switch + uwsgi_pypy_continulets[id].switch() + + # back to the main stack + if lib.uwsgi.p[modifier1].resume: +- lib.uwsgi.p[modifier1].resume(ffi.NULL) ++ lib.uwsgi.p[modifier1].resume(ffi.NULL) + + @ffi.callback("void(struct wsgi_request *)") + def uwsgi_pypy_continulet_switch(wsgi_req): +@@ -965,17 +965,17 @@ def uwsgi_pypy_continulet_switch(wsgi_req): + + # this is called in the current continulet + if lib.uwsgi.p[modifier1].suspend: +- lib.uwsgi.p[modifier1].suspend(wsgi_req) ++ lib.uwsgi.p[modifier1].suspend(wsgi_req) + + uwsgi_pypy_continulets[id].switch() + + # back to the continulet + if lib.uwsgi.p[modifier1].resume: +- lib.uwsgi.p[modifier1].resume(wsgi_req) ++ lib.uwsgi.p[modifier1].resume(wsgi_req) + + # update current running continulet + lib.uwsgi.wsgi_req = wsgi_req +- ++ + def uwsgi_pypy_setup_continulets(): + if lib.uwsgi.async <= 1: + raise Exception("pypy continulets require async mode !!!")
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl/files/patch-plugins_python_pyloader.c Sun Jun 14 22:23:07 2020 +0200 @@ -0,0 +1,11 @@ +--- plugins/python/pyloader.c.orig 2020-06-14 20:19:20 UTC ++++ plugins/python/pyloader.c +@@ -678,7 +678,7 @@ PyObject *uwsgi_paste_loader(void *arg1) { + uwsgi_log( "Loading paste environment: %s\n", paste); + + if (up.paste_logger) { +- PyObject *paste_logger_dict = get_uwsgi_pydict("paste.script.util.logging_config"); ++ PyObject *paste_logger_dict = get_uwsgi_pydict("logging.config"); + if (paste_logger_dict) { + PyObject *paste_logger_fileConfig = PyDict_GetItemString(paste_logger_dict, "fileConfig"); + if (paste_logger_fileConfig) {
