Skip to content

Commit 5d306c0

Browse files
authored
Remove the dependency on CPAN module List::MoreUtils (#337)
* Remove List::MoreUtils as a dependency * Minor updates to split_ncvars.pl * Use the POSIX shell version of list_ncvars in split_ncvars
1 parent f892fc4 commit 5d306c0

File tree

12 files changed

+11
-110
lines changed

12 files changed

+11
-110
lines changed

configure.ac

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,6 @@ AS_IF([test -z "$NCKS"],
163163

164164
AC_ARG_VAR([PERL], [Path to perl])
165165
AC_PATH_PROG(PERL, [perl])
166-
AX_PROG_PERL_MODULES([List::MoreUtils], dnl
167-
eval AS_TR_CPP(HAVE_PLMOD_LIST_MOREUTILS)=yes,
168-
AC_MSG_WARN([Perl module List::MoreUtils not found. Some applications will not be installed.]))
169-
AM_CONDITIONAL([HAVE_PLMOD_LIST_MOREUTILS], [test x$HAVE_PLMOD_LIST_MOREUTILS = xyes])
170166

171167
AX_PYTHON_MODULE([xarray],[],[python3])
172168
if test ${HAVE_PYMOD_XARRAY} = yes; then

m4/ax_prog_perl_modules.m4

Lines changed: 0 additions & 78 deletions
This file was deleted.

src/Makefile.am

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,10 @@ bin_SCRIPTS = \
1616
list_ncvars.csh \
1717
list_ncvars.sh \
1818
plevel.sh \
19+
split_ncvars.pl \
1920
timavg \
2021
timavg.csh
2122

22-
if HAVE_PLMOD_LIST_MOREUTILS
23-
bin_SCRIPTS += split_ncvars.pl
24-
endif
25-
2623
pkglibexec_PROGRAMS = \
2724
list_ncvars \
2825
print_version \
@@ -212,3 +209,8 @@ timavg.csh: timeavg/timavg.csh.in Makefile
212209
split_ncvars.pl: split_ncvars/split_ncvars.pl.in Makefile
213210
$(do_subst) < $(srcdir)/split_ncvars/split_ncvars.pl.in > split_ncvars.pl
214211
chmod +x split_ncvars.pl
212+
213+
install-exec-hook:
214+
ln $(DESTDIR)$(bindir)/split_ncvars.pl $(DESTDIR)$(bindir)/split_ncvars
215+
install-data-hook:
216+
ln $(DESTDIR)$(mandir)/man1/split_ncvars.pl.1 $(DESTDIR)$(mandir)/man1/split_ncvars.1

src/split_ncvars/split_ncvars.pl.in

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
use strict;
2929
use Cwd;
3030
use Getopt::Long;
31-
use List::MoreUtils qw{uniq};
3231
Getopt::Long::Configure("bundling");
3332
use File::Path;
3433
use File::Spec;
@@ -126,7 +125,7 @@ my $ncatted
126125
my $list_ncvars
127126
= defined( $ENV{LIST_NCVARS} )
128127
? $ENV{LIST_NCVARS}
129-
: "$/list_ncvars.csh";
128+
: "$prefix/list_ncvars.sh";
130129

131130
my $ncdump
132131
= defined( $ENV{NCDUMP} )
@@ -578,6 +577,7 @@ sub get_variable_dimensions {
578577
my $var = shift;
579578
my %cartesian_coords;
580579
my @coords;
580+
my %var_dims;
581581

582582
# Get a list of the cartesian coordinates that are in a file
583583
while ( $dump =~ /\t\t(.*):(cartesian_axis|axis) = "(.*)"/g ) {
@@ -586,7 +586,8 @@ sub get_variable_dimensions {
586586

587587
# Compare the cartesian coords to those of the variables
588588
if ( $dump =~ /\t.*$var\((.+)\)/ ) {
589-
@coords = uniq map { grep $_, split /,\s/, $1 } keys %cartesian_coords;
589+
@var_dims{ split /,\s/, $1 } = ();
590+
@coords = grep { exists $cartesian_coords{$_} } keys %var_dims;
590591
}
591592
return \@coords;
592593
}

tests/Makefile.am

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,6 @@ else
2424
skipflag=""
2525
endif
2626

27-
if HAVE_PLMOD_LIST_MOREUTILS
28-
have_plmod_list_moreutils="yes"
29-
else
30-
have_plmod_list_moreutils="no"
31-
endif
32-
3327
AM_CFLAGS = $(NETCDF_CFLAGS) -I$(top_builddir)/src -I$(top_srcdir)/tools/libfrencutils
3428
AM_FCFLAGS = -I$(top_builddir)/src
3529
LDADD = -L$(top_builddir)/src -lver $(NETCDF_LDFLAGS) $(NETCDF_LIBS)
@@ -60,7 +54,7 @@ TESTS_ENVIRONMENT = \
6054
builddir=$(abs_builddir); export builddir; \
6155
MPIRUN=$(MPIRUN); export MPIRUN; \
6256
skipflag=$(skipflag); export skipflag; \
63-
have_plmod_list_moreutils=$(have_plmod_list_moreutils); export have_plmod_list_moreutils; \
57+
PREFIX=$(abs_top_builddir)/src; export PREFIX; \
6458
PKGLIBEXECDIR="$(abs_top_builddir)/src"; export PKGLIBEXECDIR; \
6559
for d in $$( find $(abs_top_builddir)/tools -mindepth 1 -not -path '*/\.*' -type d ); do \
6660
PATH="$$d"'$(PATH_SEPARATOR)'"$$PATH"; \

tests/split_ncvars/split_ncvars

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ fi
2626

2727
. ${srcdir=.}/init.sh; path_prepend_ ../src
2828

29-
test $have_plmod_list_moreutils = no && skip_ "perl module List::MoreUtils not available"
30-
3129
# Use the test netCDF files from plevel and timeavg
3230
${builddir=.}/create_timeavg_test_ncfiles || framework_failure_ "failed to create timeavg test files"
3331
${builddir=.}/create_plevel_test_ncfile || framework_failure_ "failed to create plevel test files"

tests/split_ncvars/split_ncvars-i

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ fi
2626

2727
. ${srcdir=.}/init.sh; path_prepend_ ../src
2828

29-
test $have_plmod_list_moreutils = no && skip_ "perl module List::MoreUtils not available"
30-
3129
# Use the test netCDF files from plevel
3230
${builddir=.}/create_plevel_test_ncfile || framework_failure_ "failed to create plevel test files"
3331
mkdir idir || framework_failure_ "failed to create idir"

tests/split_ncvars/split_ncvars-l

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ fi
2626

2727
. ${srcdir=.}/init.sh; path_prepend_ ../src
2828

29-
test $have_plmod_list_moreutils = no && skip_ "perl module List::MoreUtils not available"
30-
3129
# Use the test netCDF files from timeavg
3230
${builddir=.}/create_timeavg_test_ncfiles || framework_failure_ "failed to create test files"
3331

tests/split_ncvars/split_ncvars-o

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ fi
2626

2727
. ${srcdir=.}/init.sh; path_prepend_ ../src
2828

29-
test $have_plmod_list_moreutils = no && skip_ "perl module List::MoreUtils not available"
30-
3129
# Use the test netCDF files from plevel
3230
${builddir=.}/create_plevel_test_ncfile || framework_failure_ "failed to create plevel test files"
3331

tests/split_ncvars/split_ncvars-p

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ fi
2626

2727
. ${srcdir=.}/init.sh; path_prepend_ ../src
2828

29-
test $have_plmod_list_moreutils = no && skip_ "perl module List::MoreUtils not available"
30-
3129
# Use the test netCDF files from plevel
3230
${builddir=.}/create_plevel_test_ncfile || framework_failure_ "failed to create test files"
3331

0 commit comments

Comments
 (0)