Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make an effort to save full path to parrot_config.
  • Loading branch information
bschmalhofer committed Mar 8, 2009
1 parent c0e01f7 commit dcc8595
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
24 changes: 19 additions & 5 deletions Configure.pl
Expand Up @@ -21,6 +21,12 @@ =head1 SYNOPSIS
use warnings;
use 5.008;

# core Perl 5 modules
use File::Spec ();

# Modules from CPAN
use File::Which ();

my %valid_options = (
'help' => 'Display configuration help',
'parrot-config' => 'Use configuration given by parrot_config binary',
Expand Down Expand Up @@ -98,16 +104,24 @@ sub get_command_options {

sub read_parrot_config {
my @parrot_config_exe = @_;
my %config = ();
my %config;
for my $exe (@parrot_config_exe) {
no warnings;
if (open my $PARROT_CONFIG, '-|', "$exe --dump") {
if (open my $parrot_config_fh, '-|', "$exe --dump") {
print "Reading configuration information from $exe\n";
while (<$PARROT_CONFIG>) {
while (<$parrot_config_fh>) {
if (/(\w+) => '(.*)'/) { $config{$1} = $2 }
}
close $PARROT_CONFIG;
last if %config;
close $parrot_config_fh;

if (%config) {
my $parrot_config_exe = File::Which::which($exe) if $exe eq 'parrot_config';
$parrot_config_exe ||= File::Spec->rel2abs($exe);
$parrot_config_exe ||= File::Spec->rel2abs("$exe$config{EXE}");
$parrot_config_exe ||= $exe;
$config{parrot_config_exe} = $parrot_config_exe;
last;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion build/templates/lib/Pipp/FindParrot_pm.in
Expand Up @@ -4,6 +4,6 @@ use lib '@lib_dir@@versiondir@/tools/lib';

package Pipp::FindParrot;

our $parrot_config = '@bin_dir@/parrot_config';
our $parrot_config_exe = '@parrot_config_exe@';

1;
5 changes: 1 addition & 4 deletions lib/Pipp/Test.pm
Expand Up @@ -387,10 +387,7 @@ sub _prepare_exit_message {

sub read_parrot_config {
my @parrot_config_exe = (
$Pipp::FindParrot::parrot_config,
'parrot/parrot_config',
'../../parrot_config',
'parrot_config'
$Pipp::FindParrot::parrot_config_exe,
);

my %config;
Expand Down

0 comments on commit dcc8595

Please sign in to comment.