From 5e2c88068806499124529de2120f9f826cf1e947 Mon Sep 17 00:00:00 2001 From: Ed J Date: Wed, 18 Sep 2024 19:12:07 +0000 Subject: [PATCH] handle Gnuplot 6 warnings about Qt plugins --- CHANGES | 2 ++ lib/PDL/Graphics/Gnuplot.pm | 7 +++++-- t/plot.t | 8 +++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index 2a96fb8..6d9ec50 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,5 @@ +- handle Gnuplot 6 warnings about Qt plugins + 2.027 2024-07-31 - add "resample" curve option for with=>'fits' - with=>'fits' error if no FITS header diff --git a/lib/PDL/Graphics/Gnuplot.pm b/lib/PDL/Graphics/Gnuplot.pm index 8e9606f..76b2122 100644 --- a/lib/PDL/Graphics/Gnuplot.pm +++ b/lib/PDL/Graphics/Gnuplot.pm @@ -7470,6 +7470,7 @@ sub _printGnuplotPipe # are explicitly stripped out our $cp_serial = 0; +my $qt_re = qr/^qt.qpa.plugin: Could not find the Qt platform plugin.*/m; sub _checkpoint { my $this = shift; my $suffix = shift || "main"; @@ -7602,16 +7603,18 @@ EOM # that some warnings come with a line specifier and others don't. WARN: while( $fromerr =~ m/^(\s*(line \d+\:\s*)?[wW]arning\:.*)$/m or + $fromerr =~ m/$qt_re/ or $fromerr =~ m/^Populating font family aliases took/m # CED - Quicktime on MacOS Catalina throws a warning marked as an error. Stupid. ) { - if($2){ + if ($2) { # it's a warning with a line specifier. Break off two more lines before it. last WARN unless($fromerr =~ s/^((gnu|multi)plot\>.*\n\s*\^\s*\n\s*(line \d+\:\s*)?[wW]arning\:.*(\n|$))//m); my $a = $1; $a =~ s/^\s*line \d+\:/Gnuplot:/m; carp $a if($printwarnings); } else { - last WARN unless($fromerr =~ s/^(\s*(line \d+\:\s*)?[wW](arning\:.*(\n|$)))//m); + $fromerr =~ s/$qt_re//; + last WARN unless $fromerr =~ s/^(\s*(line \d+\:\s*)?[wW](arning\:.*(\n|$)))//m; carp "Gnuplot w$3\n" if($printwarnings); } diff --git a/t/plot.t b/t/plot.t index 53ef30e..1bfbfb5 100644 --- a/t/plot.t +++ b/t/plot.t @@ -549,9 +549,11 @@ SKIP: { skip "Skipping interactive tests - set env. variable GNUPLOT_INTERACTIVE to enable.",29; } - eval { $w = gpwin('wxt') }; - eval { $w = gpwin('x11') } if $@; - is($@, '', "created a wxt or x11 plot object"); + for (qw(qt wxt x11)) { + eval { $w = gpwin($_) }; + last if !$@; + } + is($@, '', "created a plot object"); isa_ok $PDL::Graphics::Gnuplot::termTab->{$w->{terminal}}, 'HASH', "Terminal is a known type";