Don't check cpanm existence if SLIC3R_NO_AUTO

xs
Alessandro Ranellucci 2013-06-24 16:39:31 +02:00
parent ddc8727b70
commit f32551bd35
1 changed files with 26 additions and 26 deletions

View File

@ -45,27 +45,26 @@ if ($ENV{SLIC3R_NO_AUTO}) {
next if eval "use $module $version; 1"; next if eval "use $module $version; 1";
print "Missing optional $module $version\n"; print "Missing optional $module $version\n";
} }
} } else {
my @try = (
my @try = (
$ENV{CPANM} // (), $ENV{CPANM} // (),
File::Spec->catfile($Config{sitebin}, 'cpanm'), File::Spec->catfile($Config{sitebin}, 'cpanm'),
File::Spec->catfile($Config{installscript}, 'cpanm'), File::Spec->catfile($Config{installscript}, 'cpanm'),
); );
my $cpanm; my $cpanm;
foreach my $path (@try) { foreach my $path (@try) {
if (-e $path) { # don't use -x because it fails on Windows if (-e $path) { # don't use -x because it fails on Windows
$cpanm = $path; $cpanm = $path;
last; last;
} }
} }
if (!$cpanm) { if (!$cpanm) {
if ($^O =~ /^(?:darwin|linux)$/ && system(qw(which cpanm)) == 0) { if ($^O =~ /^(?:darwin|linux)$/ && system(qw(which cpanm)) == 0) {
$cpanm = 'cpanm'; $cpanm = 'cpanm';
} }
} }
die <<'EOF' die <<'EOF'
cpanm was not found. Please install it before running this script. cpanm was not found. Please install it before running this script.
There are several ways to install cpanm, try one of these: There are several ways to install cpanm, try one of these:
@ -81,11 +80,12 @@ If it is installed in a non-standard location you can do:
EOF EOF
if !$cpanm; if !$cpanm;
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};
my $res = system $cpanm, "$module~$version"; my $res = system $cpanm, "$module~$version";
$skip_tests = 1 if $res != 0; $skip_tests = 1 if $res != 0;
}
} }
if (eval "use App::Prove; 1" && !$skip_tests) { if (eval "use App::Prove; 1" && !$skip_tests) {