Merge branch 'master' into xs

Conflicts:
	Build.PL
This commit is contained in:
Alessandro Ranellucci 2013-06-24 19:37:07 +02:00
commit ecdc2f077b
2 changed files with 43 additions and 31 deletions

View File

@ -32,25 +32,39 @@ my %recommends = qw(
# removed: # removed:
# Wx 0.9901 # Wx 0.9901
my @try = ( my $missing_prereqs = 0;
if ($ENV{SLIC3R_NO_AUTO}) {
foreach my $module (sort keys %prereqs) {
my $version = $prereqs{$module};
next if eval "use $module $version; 1";
$missing_prereqs = 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";
}
} else {
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:
@ -66,21 +80,19 @@ 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};
if ($ENV{SLIC3R_NO_AUTO}) { my $res = system $cpanm, "$module~$version";
print "Missing prerequisite $module $version\n" $missing_prereqs = 1 if $res != 0 && exists $prereqs{$module};
if !eval "use $module $version; 1";
} else {
system $cpanm, "$module~$version";
} }
} }
exit if $ENV{SLIC3R_NO_AUTO};
system $cpanm, '--reinstall', './xs'; system $cpanm, '--reinstall', './xs';
if (eval "use App::Prove; 1") { if (eval "use App::Prove; 1" && !$missing_prereqs) {
App::Prove->new->run; App::Prove->new->run;
} }
exit 1 if $missing_prereqs;
__END__ __END__

View File

@ -167,13 +167,13 @@ sub OnInit {
$helpMenu->Append(MI_WEBSITE, "Slic3r &Website", 'Open the Slic3r website in your browser'); $helpMenu->Append(MI_WEBSITE, "Slic3r &Website", 'Open the Slic3r website in your browser');
my $versioncheck = $helpMenu->Append(MI_VERSIONCHECK, "Check for &Updates...", 'Check for new Slic3r versions'); my $versioncheck = $helpMenu->Append(MI_VERSIONCHECK, "Check for &Updates...", 'Check for new Slic3r versions');
$versioncheck->Enable(Slic3r::GUI->have_version_check); $versioncheck->Enable(Slic3r::GUI->have_version_check);
$helpMenu->Append(MI_DOCUMENTATION, "&Documentation", 'Open the Slic3r documentation in your browser'); $helpMenu->Append(MI_DOCUMENTATION, "Slic3r &Manual", 'Open the Slic3r manual in your browser');
$helpMenu->AppendSeparator(); $helpMenu->AppendSeparator();
$helpMenu->Append(wxID_ABOUT, "&About Slic3r", 'Show about dialog'); $helpMenu->Append(wxID_ABOUT, "&About Slic3r", 'Show about dialog');
EVT_MENU($frame, MI_CONF_WIZARD, sub { $self->{skeinpanel}->config_wizard }); EVT_MENU($frame, MI_CONF_WIZARD, sub { $self->{skeinpanel}->config_wizard });
EVT_MENU($frame, MI_WEBSITE, sub { Wx::LaunchDefaultBrowser('http://slic3r.org/') }); EVT_MENU($frame, MI_WEBSITE, sub { Wx::LaunchDefaultBrowser('http://slic3r.org/') });
EVT_MENU($frame, MI_VERSIONCHECK, sub { Slic3r::GUI->check_version(manual => 1) }); EVT_MENU($frame, MI_VERSIONCHECK, sub { Slic3r::GUI->check_version(manual => 1) });
EVT_MENU($frame, MI_DOCUMENTATION, sub { Wx::LaunchDefaultBrowser('https://github.com/alexrj/Slic3r/wiki/Documentation') }); EVT_MENU($frame, MI_DOCUMENTATION, sub { Wx::LaunchDefaultBrowser('https://manual.slic3r.org/') });
EVT_MENU($frame, wxID_ABOUT, \&about); EVT_MENU($frame, wxID_ABOUT, \&about);
} }