Have SLIC3R_NO_AUTO check dependencies before requiring cpanm, and don't skip tests if all prerequisites are there

This commit is contained in:
Alessandro Ranellucci 2013-06-24 16:32:03 +02:00
parent 9e927ffaf9
commit ddc8727b70

View File

@ -32,6 +32,21 @@ my %recommends = qw(
# removed: # removed:
# Wx 0.9901 # 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 = ( my @try = (
$ENV{CPANM} // (), $ENV{CPANM} // (),
File::Spec->catfile($Config{sitebin}, 'cpanm'), File::Spec->catfile($Config{sitebin}, 'cpanm'),
@ -69,16 +84,11 @@ EOF
my %modules = (%prereqs, %recommends); my %modules = (%prereqs, %recommends);
foreach my $module (sort keys %modules) { foreach my $module (sort keys %modules) {
my $version = $modules{$module}; my $version = $modules{$module};
if ($ENV{SLIC3R_NO_AUTO}) { my $res = system $cpanm, "$module~$version";
print "Missing prerequisite $module $version\n" $skip_tests = 1 if $res != 0;
if !eval "use $module $version; 1";
} else {
system $cpanm, "$module~$version";
}
} }
exit if $ENV{SLIC3R_NO_AUTO};
if (eval "use App::Prove; 1") { if (eval "use App::Prove; 1" && !$skip_tests) {
App::Prove->new->run; App::Prove->new->run;
} }