Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use for_list feature, require perl 5.36 #944

Merged
merged 15 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/linux_de_locale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: shogo82148/actions-setup-perl@v1
with:
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
ls -l perlversion.txt

- name: Cache CPAN modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/perl5
key: ${{ runner.os }}-build-${{ hashFiles('perlversion.txt') }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
runs-on: macOS-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Perl
run: |
Expand All @@ -47,7 +47,7 @@ jobs:
ls -l perlversion.txt

- name: Cache CPAN modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/perl5
key: ${{ runner.os }}-build-${{ hashFiles('perlversion.txt') }}
Expand Down
126 changes: 10 additions & 116 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,130 +9,24 @@ on:
pull_request:

env:
PERL5LIB: c:\cx\lib\perl5
PERL_LOCAL_LIB_ROOT: c:/cx
PERL_MB_OPT: --install_base C:/cx
PERL_MM_OPT: INSTALL_BASE=C:/cx
#ALIEN_BUILD_PRELOAD: Fetch::Cache
AUTOMATED_TESTING: 1

jobs:
perl:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Perl
run: |
choco install strawberryperl
echo "C:\strawberry\c\bin;C:\strawberry\perl\site\bin;C:\strawberry\perl\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
##echo $env:PATH

#- name: Check path
# run: |
# echo $env:PATH
# echo "glargglarg"
# echo $GITHUB_PATH
# echo "zogzogzog"
# $env:PATH = "C:\strawberry\c\bin;C:\strawberry\perl\site\bin;C:\strawberry\perl\bin;$env:PATH"
# echo $env:PATH
# echo "zigzig"
# echo "C:\strawberry\c\bin;C:\strawberry\perl\site\bin;C:\strawberry\perl\bin;$env:PATH" > $GITHUB_PATH
# echo $GITHUB_PATH

- name: perl -V
run: perl -V

- name: Prepare for CPAN cache
run: |
perl -V > perlversion.txt
echo "20220920" >> perlversion.txt
dir perlversion.txt

- name: Cache CPAN modules
uses: actions/cache@v3
with:
path: c:\cx
key: ${{ runner.os }}-build-${{ hashFiles('perlversion.txt') }}
restore-keys: |
${{ runner.os }}-build-${{ hashFiles('perlversion.txt') }}

- name: Prepare for Alien cache
run: |
perl -V > aliencache.txt
echo 'aliens' >> aliencache.txt
dir aliencache.txt

- name: Cache Alien downloads
uses: actions/cache@v3
- uses: shogo82148/actions-setup-perl@v1
with:
path: $HOMEPATH\.alienbuild
key: ${{ runner.os }}-build-${{ hashFiles('aliencache.txt') }}
restore-keys: |
${{ runner.os }}-build-${{ hashFiles('aliencache.txt') }}

#- name: Install Dependencies
# run: curl -sL https://git.io/cpm | perl - install -g --show-build-log-on-failure


#- name: Install dependencies 1
# run: |
# #cpanm --notest local::lib
# #eval "$(perl -Mlocal::lib=${PWD}/perl_modules)"
# cpanm --quiet --notest Alien::Build
# cpanm --quiet --notest Alien::Build::MM
# cpanm --quiet --notest Sort::Versions
# cpanm --quiet --notest PkgConfig
# cpanm --quiet --notest Alien::Build::Plugin::Cleanse::BuildDir
# cpanm --quiet --notest File::Find::Rule
# cpanm --quiet --notest Alien::Build::Plugin::Fetch::Cache
# cpanm --quiet --notest Env::ShellWords
# cpanm --quiet --notest Test2::Suite
perl-version: "5.38"
distribution: strawberry
install-modules-with: cpanm
install-modules-args: --with-develop --with-configure --verbose

- name: Install dependencies Alien::MSYS
run: |
cpanm Alien::Build::Plugin::Fetch::Cache
cpanm --notest Alien::MSYS

- name: Install dependencies Alien::sqlite
run: |
echo $env:PATH
cpanm --notest --installdeps Alien::sqlite
cpanm -v Alien::sqlite~1.05

- name: Install dependencies Alien::proj
run: |
#cpanm -v --notest https://github.com/shawnlaffan/perl-alien-proj.git
cpanm --notest --installdeps Alien::proj
cpanm -v --notest Alien::proj

- name: Install dependencies Alien::geos::af
run: |
cpanm --notest --installdeps Alien::geos::af
cpanm -v Alien::geos::af

- name: Install dependencies Alien::gdal
run: |
cpanm --notest --installdeps Alien::gdal
echo "ALIEN_GDAL_CONFIG_ARGS=--with-hide_internal_symbols" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# qhull issues on gdal 3.5, maybe fixed in 3.6
$env:ALIEN_GDAL_CONFIG_ARGS = "--with-hide-internal-symbols=yes --without-gnm --without-qhull"
Get-PSDrive C | Select-Object Used,Free
# clunky path override
# $env:PATH = "C:\strawberry\c\bin;C:\strawberry\perl\site\bin;C:\strawberry\perl\bin;$env:PATH"
cpanm -v Alien::gdal
Get-PSDrive C | Select-Object Used,Free

- name: Install task deps
run: |
#cpanm --notest Task::Biodiverse::NoGUI
cpanm --notest --no-man-pages PDL
cpanm --notest --installdeps .
cpanm --installdeps .

# Runs a set of commands using the runners shell
- name: Run tests
- name: run tests
run: |
prove

#echo 1
perl -E'say join q{ }, @INC'
prove -l t
5 changes: 3 additions & 2 deletions Makefile.PL
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use strict;
use warnings;
use 5.010;
use 5.036;
use ExtUtils::MakeMaker;

# these are from the cpanfile
Expand All @@ -13,7 +13,7 @@ my %common_reqs = (
"Data::Compare" => 0,
"Exception::Class" => 0,
"Exporter::Easy" => 0,
"Faster::Maths" => 0,
#"Faster::Maths" => 0,
"File::BOM" => 0,
"File::Find::Rule" => 0,
"Geo::Converter::dms2dd" => "0.05",
Expand Down Expand Up @@ -76,6 +76,7 @@ my %WriteMakefileArgs = (
"AUTHOR" => 'Shawn Laffan <shawnlaffan@gmail.com>',
"NAME" => "Biodiverse",
"VERSION_FROM" => "lib/App/Biodiverse.pm",
MIN_PERL_VERSION => '5.036',
"CONFIGURE_REQUIRES" => {
%common_reqs,
},
Expand Down
16 changes: 9 additions & 7 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ branches:
skip_tags: true

cache:
- C:\Strawberry
- C:\Strawberry538
#- C:\Strawberry -> appveyor.yml

install:
- if not exist "C:\strawberry" appveyor-retry choco install strawberryperl --version 5.30.2.1
#- appveyor-retry choco upgrade strawberryperl --version 5.28.1.1
- set ST=C:\Strawberry
- set ST=C:\Strawberry538
- if exist %ST% del /Q %ST%
- if not exist %ST% appveyor-retry choco install strawberryperl --version 5.38.0 --install-arguments="INSTALLDIR=""C:\Strawberry538"""
# - appveyor-retry choco upgrade strawberryperl --version 5.38.0
- refreshenv
- set PATH=%ST%\perl\bin;%ST%\perl\site\bin;%ST%\c\bin;%PATH%
- path
- cd C:\projects\%APPVEYOR_PROJECT_NAME%
Expand All @@ -31,14 +33,14 @@ install:
- cpanm -v Alien::libtiff
- cpanm -v Alien::proj

- set ALIEN_GDAL_CONFIG_ARGS=--without-spatialite --without-gnm --without-qhull
# - set ALIEN_GDAL_CONFIG_ARGS=--without-spatialite --without-gnm --without-qhull
- cpanm -v Alien::gdal

- cpanm --notest --installdeps .
- cpanm --installdeps .


build_script:
- prove -l
#- perl -e "1"
# - perl -e "1"

2 changes: 1 addition & 1 deletion bin/BiodiverseGUI.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use warnings;
use Carp;

use 5.022;
use 5.036;

#use File::Basename;
use Cwd;
Expand Down
2 changes: 1 addition & 1 deletion cpanfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ requires "Excel::ValueReader::XLSX";
requires "Exception::Class";
requires "Exporter::Easy";
#requires "FFI::Platypus::Declare";
requires "Faster::Maths";
# requires "Faster::Maths"; # disabled for now
requires "File::BOM";
requires "File::Find::Rule";
requires "Geo::Converter::dms2dd", "0.05";
Expand Down
2 changes: 2 additions & 0 deletions lib/App/Biodiverse.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package App::Biodiverse;
use strict;
use warnings;

use 5.036;

our $VERSION = '4.99_002';

1;
Expand Down
5 changes: 2 additions & 3 deletions lib/Biodiverse/BaseData.pm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use Ref::Util qw { :all };
use Sort::Key::Natural qw /natkeysort/;


use experimental qw /refaliasing declared_refs/;
use experimental qw /refaliasing declared_refs for_list/;


use English qw { -no_match_vars };
Expand Down Expand Up @@ -1967,8 +1967,7 @@ sub delete_sub_elements_collated_by_group {

my %labels_processed;

foreach my $group ( keys %$gp_lb_hash ) {
my $label_subhash = $gp_lb_hash->{$group};
foreach my ($group, $label_subhash) ( %$gp_lb_hash ) {
foreach my $label ( keys %$label_subhash ) {
$labels_processed{$label}++;
$labels_ref->delete_sub_element_aa( $label, $group );
Expand Down
6 changes: 4 additions & 2 deletions lib/Biodiverse/BaseStruct.pm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ use warnings;
use Carp;
use 5.010;

use experimental 'for_list';

use English ( -no_match_vars );

#use Data::Dumper ();
Expand Down Expand Up @@ -1131,8 +1133,8 @@ sub add_to_lists { # add to a list, create if not already there.
my $use_ref = delete $args{use_ref};
# should it be in its own sub?

foreach my $list_name (keys %args) {
my $list_values = $args{$list_name};
foreach my ($list_name, $list_values) (%args) {
# my $list_values = $args{$list_name};
if ($use_ref) {
$self->{ELEMENTS}{$element}{$list_name} = $list_values;
}
Expand Down
15 changes: 6 additions & 9 deletions lib/Biodiverse/Cluster.pm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use Sort::Key::Natural qw /natsort/;
use Path::Tiny qw /path/;


use experimental qw /declared_refs/;
use experimental qw /declared_refs for_list/;

use Geo::GDAL::FFI;
# silence some used-once warnings - very clunky
Expand Down Expand Up @@ -1640,8 +1640,7 @@ sub get_most_similar_pair {
my $csv = $self->get_csv_object;
my @pairs;
my $pair_key_cache = $self->get_cached_value_dor_set_default_aa ('TIE_BREAKER_STRINGIFIED_PAIR_KEYS', {});
foreach my $name1 (keys %$keys_ref) {
my $ref = $keys_ref->{$name1};
foreach my ($name1, $ref) (%$keys_ref) {
foreach my $name2 (keys %$ref) {
my $stringified
= $pair_key_cache->{$name1}{$name2}
Expand Down Expand Up @@ -1941,8 +1940,7 @@ sub get_outputs_with_same_index_and_spatial_conditions {
no_regexp => 1,
);
my %required;
foreach my $calc (keys %required_args) {
my $r = $required_args{$calc};
foreach my ($calc, $r) (%required_args) {
@required{keys %$r} = values %$r;
}

Expand Down Expand Up @@ -2855,12 +2853,11 @@ sub sp_calc {
current_node_details => $current_node_details,
);

foreach my $key (keys %sp_calc_values) {
if (is_arrayref($sp_calc_values{$key})
|| is_hashref($sp_calc_values{$key})) {
foreach my ($key, $ref) (%sp_calc_values) {
if (is_arrayref($ref) || is_hashref($ref)) {

$node->add_to_lists (
$key => $sp_calc_values{$key},
$key => $ref,
use_ref => 1,
);
delete $sp_calc_values{$key};
Expand Down
Loading
Loading