Richard W.M. Jones
2018-Oct-01 13:44 UTC
[Libguestfs] [PATCH nbdkit] plugins: Add scripting language version to --dump-plugin output.
On Lua: lua_version=5.3.4 On Perl: perl_version=5.28.0 On Python 2: python_version=2.7.15 On Python 3: python_version=3.7.0 python_pep_384_abi_version=3 On Ruby 2.5.1p57: ruby_api_version=2.5.0 On Tcl: tcl_version=8.6 tcl_patch_level=8.6.8 --- plugins/lua/lua.c | 11 +++++++++++ plugins/perl/perl.c | 4 ++++ plugins/python/python.c | 8 ++++++++ plugins/ruby/ruby.c | 14 ++++++++++++++ plugins/tcl/tcl.c | 8 ++++++++ 5 files changed, 45 insertions(+) diff --git a/plugins/lua/lua.c b/plugins/lua/lua.c index a73a4da..2bad44c 100644 --- a/plugins/lua/lua.c +++ b/plugins/lua/lua.c @@ -102,6 +102,17 @@ function_defined (const char *name) static void lua_plugin_dump_plugin (void) { +#ifdef LUA_VERSION_MAJOR + printf ("lua_version=%s", LUA_VERSION_MAJOR); +#ifdef LUA_VERSION_MINOR + printf (".%s", LUA_VERSION_MINOR); +#ifdef LUA_VERSION_RELEASE + printf (".%s", LUA_VERSION_RELEASE); +#endif +#endif + printf ("\n"); +#endif + if (script && function_defined ("dump_plugin")) { lua_getglobal (L, "dump_plugin"); if (lua_pcall (L, 0, 0, 0) != 0) { diff --git a/plugins/perl/perl.c b/plugins/perl/perl.c index 3fce279..4cee89d 100644 --- a/plugins/perl/perl.c +++ b/plugins/perl/perl.c @@ -169,6 +169,10 @@ perl_dump_plugin (void) { dSP; +#ifdef PERL_VERSION_STRING + printf ("perl_version=%s\n", PERL_VERSION_STRING); +#endif + if (script && callback_defined ("dump_plugin")) { ENTER; SAVETMPS; diff --git a/plugins/python/python.c b/plugins/python/python.c index ef1a2cf..8b16d7e 100644 --- a/plugins/python/python.c +++ b/plugins/python/python.c @@ -259,6 +259,14 @@ py_dump_plugin (void) PyObject *fn; PyObject *r; +#ifdef PY_VERSION + printf ("python_version=%s\n", PY_VERSION); +#endif + +#ifdef PYTHON_ABI_VERSION + printf ("python_pep_384_abi_version=%d\n", PYTHON_ABI_VERSION); +#endif + if (script && callback_defined ("dump_plugin", &fn)) { PyErr_Clear (); diff --git a/plugins/ruby/ruby.c b/plugins/ruby/ruby.c index aa57f65..a3d7a42 100644 --- a/plugins/ruby/ruby.c +++ b/plugins/ruby/ruby.c @@ -41,6 +41,9 @@ #include <nbdkit-plugin.h> #include <ruby.h> +#ifdef HAVE_RUBY_VERSION_H +#include <ruby/version.h> +#endif static VALUE nbdkit_module = Qnil; static int last_error; @@ -168,6 +171,17 @@ plugin_rb_unload (void) static void plugin_rb_dump_plugin (void) { +#ifdef RUBY_API_VERSION_MAJOR + printf ("ruby_api_version=%d", RUBY_API_VERSION_MAJOR); +#ifdef RUBY_API_VERSION_MINOR + printf (".%d", RUBY_API_VERSION_MINOR); +#ifdef RUBY_API_VERSION_TEENY + printf (".%d", RUBY_API_VERSION_TEENY); +#endif +#endif + printf ("\n"); +#endif + if (!script) return; diff --git a/plugins/tcl/tcl.c b/plugins/tcl/tcl.c index b814195..b30fefd 100644 --- a/plugins/tcl/tcl.c +++ b/plugins/tcl/tcl.c @@ -95,6 +95,14 @@ proc_defined (const char *name) static void tcl_dump_plugin (void) { +#ifdef TCL_VERSION + printf ("tcl_version=%s\n", TCL_VERSION); +#endif + +#ifdef TCL_PATCH_LEVEL + printf ("tcl_patch_level=%s\n", TCL_PATCH_LEVEL); +#endif + if (script && proc_defined ("dump_plugin")) { int r; Tcl_Obj *cmd; -- 2.19.0.rc0
Pino Toscano
2018-Oct-01 14:15 UTC
Re: [Libguestfs] [PATCH nbdkit] plugins: Add scripting language version to --dump-plugin output.
On Monday, 1 October 2018 15:44:37 CEST Richard W.M. Jones wrote:> On Lua: > > lua_version=5.3.4 > > On Perl: > > perl_version=5.28.0 > > On Python 2: > > python_version=2.7.15 > > On Python 3: > > python_version=3.7.0 > python_pep_384_abi_version=3 > > On Ruby 2.5.1p57: > > ruby_api_version=2.5.0Should this be ruby_version, to be like the others? Other than that, LGTM. -- Pino Toscano
Richard W.M. Jones
2018-Oct-01 14:20 UTC
Re: [Libguestfs] [PATCH nbdkit] plugins: Add scripting language version to --dump-plugin output.
On Mon, Oct 01, 2018 at 04:15:03PM +0200, Pino Toscano wrote:> On Monday, 1 October 2018 15:44:37 CEST Richard W.M. Jones wrote: > > On Lua: > > > > lua_version=5.3.4 > > > > On Perl: > > > > perl_version=5.28.0 > > > > On Python 2: > > > > python_version=2.7.15 > > > > On Python 3: > > > > python_version=3.7.0 > > python_pep_384_abi_version=3 > > > > On Ruby 2.5.1p57: > > > > ruby_api_version=2.5.0 > > Should this be ruby_version, to be like the others?It seems like it really is an "API" version. Note it doesn't match the Ruby version that I have installed. I couldn't find a way to get the Ruby version (but the Ruby plugin is terminally broken anyway because Ruby threads and garbage collection are broken so this is issue is moot). Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
Maybe Matching Threads
- Re: [PATCH nbdkit] plugins: Add scripting language version to --dump-plugin output.
- Update on: Installing the Rcmdr and tclk package
- [PATCH] configure: Move language binding detection to separate files.
- Lua improvements
- [PATCH 00/16] Refactoring of configure.ac and guestfs.pod