diff --git a/plugins/psgi/psgi_plugin.c b/plugins/psgi/psgi_plugin.c index de70395b..0f47d4db 100644 --- a/plugins/psgi/psgi_plugin.c +++ b/plugins/psgi/psgi_plugin.c @@ -16,6 +16,9 @@ struct uwsgi_option uwsgi_perl_options[] = { {"psgi", required_argument, 0, "load a psgi app", uwsgi_opt_set_str, &uperl.psgi, 0}, {"perl-no-die-catch", no_argument, 0, "do not catch $SIG{__DIE__}", uwsgi_opt_true, &uperl.no_die_catch, 0}, {"perl-local-lib", required_argument, 0, "set perl locallib path", uwsgi_opt_set_str, &uperl.locallib, 0}, +#ifdef PERL_VERSION_STRING + {"perl-version", no_argument, 0, "print perl version", uwsgi_opt_print, PERL_VERSION_STRING, UWSGI_OPT_IMMEDIATE}, +#endif {0, 0, 0, 0, 0, 0, 0}, }; diff --git a/plugins/python/python_plugin.c b/plugins/python/python_plugin.c index a26edf76..1d907894 100644 --- a/plugins/python/python_plugin.c +++ b/plugins/python/python_plugin.c @@ -46,6 +46,23 @@ void uwsgi_opt_pyrun(char *opt, char *value, void *foobar) { up.pyrun = value; } +void uwsgi_opt_pyver(char *opt, char *foo, void *bar) { +#ifndef UWSGI_PYPY + const char *version = Py_GetVersion(); +#else + const char *version = PYPY_VERSION; +#endif + const char *space = strchr(version, ' '); + if (space) { + fprintf(stdout, "%.*s\n", (int) (space-version), version); + } + else { + fprintf(stdout, "%s\n", version); + } + exit(0); +} + + #ifdef UWSGI_INI void uwsgi_opt_ini_paste(char *opt, char *value, void *foobar) { @@ -142,6 +159,8 @@ struct uwsgi_option uwsgi_python_options[] = { {"wsgi-env-behavior", required_argument, 0, "set the strategy for allocating/deallocating the WSGI env", uwsgi_opt_set_str, &up.wsgi_env_behaviour, 0}, {"start_response-nodelay", no_argument, 0, "send WSGI http headers as soon as possible (PEP violation)", uwsgi_opt_true, &up.start_response_nodelay, 0}, + {"python-version", no_argument, 0, "report python version", uwsgi_opt_pyver, NULL, UWSGI_OPT_IMMEDIATE}, + {0, 0, 0, 0, 0, 0, 0}, };