From ddc8727b70816c16d4806850ba0ecb16e465e00f Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Mon, 24 Jun 2013 16:32:03 +0200 Subject: [PATCH] Have SLIC3R_NO_AUTO check dependencies before requiring cpanm, and don't skip tests if all prerequisites are there --- Build.PL | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/Build.PL b/Build.PL index c6fd4543e..9cbf5717b 100644 --- a/Build.PL +++ b/Build.PL @@ -32,6 +32,21 @@ my %recommends = qw( # removed: # Wx 0.9901 +my $skip_tests = 0; +if ($ENV{SLIC3R_NO_AUTO}) { + foreach my $module (sort keys %prereqs) { + my $version = $prereqs{$module}; + next if eval "use $module $version; 1"; + $skip_tests = 1 if exists $prereqs{$module}; + print "Missing prerequisite $module $version\n"; + } + foreach my $module (sort keys %recommends) { + my $version = $recommends{$module}; + next if eval "use $module $version; 1"; + print "Missing optional $module $version\n"; + } +} + my @try = ( $ENV{CPANM} // (), File::Spec->catfile($Config{sitebin}, 'cpanm'), @@ -69,16 +84,11 @@ EOF my %modules = (%prereqs, %recommends); foreach my $module (sort keys %modules) { my $version = $modules{$module}; - if ($ENV{SLIC3R_NO_AUTO}) { - print "Missing prerequisite $module $version\n" - if !eval "use $module $version; 1"; - } else { - system $cpanm, "$module~$version"; - } + my $res = system $cpanm, "$module~$version"; + $skip_tests = 1 if $res != 0; } -exit if $ENV{SLIC3R_NO_AUTO}; -if (eval "use App::Prove; 1") { +if (eval "use App::Prove; 1" && !$skip_tests) { App::Prove->new->run; }