first almost-working commit for uWSGI mules

This commit is contained in:
roberto@debian32
2011-10-02 20:05:31 +02:00
parent 4c36280287
commit 531a850a71
10 changed files with 188 additions and 20 deletions
+19 -1
View File
@@ -51,6 +51,8 @@ struct option uwsgi_python_options[] = {
{"no-site", no_argument, &Py_NoSiteFlag, 1},
#endif
{"pyshell", no_argument, 0, LONG_ARGS_PYSHELL},
{"python", required_argument, 0, LONG_ARGS_PYTHON_RUN},
{"py", required_argument, 0, LONG_ARGS_PYTHON_RUN},
{0, 0, 0, 0},
};
@@ -523,12 +525,20 @@ void init_uwsgi_embedded_module() {
}
}
uwsgi_log("getting exported opts\n");
PyObject *py_opt_dict = PyDict_New();
for (i = 0; i < uwsgi.exported_opts_cnt; i++) {
uwsgi_log("%s = %s\n", uwsgi.exported_opts[i]->key, uwsgi.exported_opts[i]->value);
if (PyDict_Contains(py_opt_dict, PyString_FromString(uwsgi.exported_opts[i]->key))) {
PyObject *py_opt_item = PyDict_GetItemString(py_opt_dict, uwsgi.exported_opts[i]->key);
if (PyList_Check(py_opt_item)) {
PyList_Append(py_opt_item, PyString_FromString(uwsgi.exported_opts[i]->value));
if (uwsgi.exported_opts[i]->value == NULL) {
PyList_Append(py_opt_item, Py_True);
}
else {
PyList_Append(py_opt_item, PyString_FromString(uwsgi.exported_opts[i]->value));
}
}
else {
PyObject *py_opt_list = PyList_New(0);
@@ -553,6 +563,8 @@ void init_uwsgi_embedded_module() {
}
}
uwsgi_log("DONE\n");
if (PyDict_SetItemString(up.embedded_dict, "opt", py_opt_dict)) {
PyErr_Print();
exit(1);
@@ -898,7 +910,9 @@ void uwsgi_python_init_apps() {
#endif
}
uwsgi_log("init_pyargv\n");
init_pyargv();
uwsgi_log("init_pyargv\n");
#ifndef UWSGI_PYPY
#ifdef UWSGI_EMBEDDED
@@ -906,6 +920,8 @@ void uwsgi_python_init_apps() {
#endif
#endif
uwsgi_log("init_pyargv\n");
#ifdef __linux__
#if !defined(PYTHREE) && !defined(UWSGI_PYPY)
uwsgi_init_symbol_import();
@@ -919,6 +935,8 @@ void uwsgi_python_init_apps() {
exit(1);
}
uwsgi_log("init_pyargv\n");
init_uwsgi_vars();
// setup app loaders