diff options
author | Steve Peters <steve@fisharerojo.org> | 2006-07-06 15:38:51 +0000 |
---|---|---|
committer | Steve Peters <steve@fisharerojo.org> | 2006-07-06 15:38:51 +0000 |
commit | f943a5bf3fa0f85f262e926ddedb02aad0fc623c (patch) | |
tree | a0d6857e95fe5912dd07c0001496e4ab2b8903f5 /lib/Module/Build/Platform | |
parent | affad850140455cfdbfe87c7519ca10909a8bf23 (diff) | |
download | perl-f943a5bf3fa0f85f262e926ddedb02aad0fc623c.tar.gz |
Upgrade to Module-Build-0.2801.
p4raw-id: //depot/perl@28495
Diffstat (limited to 'lib/Module/Build/Platform')
-rw-r--r-- | lib/Module/Build/Platform/Unix.pm | 11 | ||||
-rw-r--r-- | lib/Module/Build/Platform/Windows.pm | 27 |
2 files changed, 29 insertions, 9 deletions
diff --git a/lib/Module/Build/Platform/Unix.pm b/lib/Module/Build/Platform/Unix.pm index e6060fefa5..18b68555a5 100644 --- a/lib/Module/Build/Platform/Unix.pm +++ b/lib/Module/Build/Platform/Unix.pm @@ -13,6 +13,17 @@ sub make_tarball { $self->SUPER::make_tarball(@_); } +sub is_executable { + # We consider the owner bit to be authoritative on a file, because + # -x will always return true if the user is root and *any* + # executable bit is set. The -x test seems to try to answer the + # question "can I execute this file", but I think we want "is this + # file executable". + + my ($self, $file) = @_; + return +(stat $file)[2] & 0100; +} + sub _startperl { "#! " . shift()->perl } sub _construct { diff --git a/lib/Module/Build/Platform/Windows.pm b/lib/Module/Build/Platform/Windows.pm index 9cde7a9806..774db99d65 100644 --- a/lib/Module/Build/Platform/Windows.pm +++ b/lib/Module/Build/Platform/Windows.pm @@ -54,17 +54,26 @@ sub make_executable { $self->SUPER::make_executable(@_); foreach my $script (@_) { - my %opts = (); - if ( $script eq $self->build_script ) { - $opts{ntargs} = q(-x -S %0 --build_bat %*); - $opts{otherargs} = q(-x -S "%0" --build_bat %1 %2 %3 %4 %5 %6 %7 %8 %9); - } - my $out = eval {$self->pl2bat(in => $script, update => 1, %opts)}; - if ( $@ ) { - $self->log_warn("WARNING: Unable to convert file '$script' to an executable script:\n$@"); + # Native batch script + if ( $script =~ /\.(bat|cmd)$/ ) { + $self->SUPER::make_executable($script); + next; + + # Perl script that needs to be wrapped in a batch script } else { - $self->SUPER::make_executable($out); + my %opts = (); + if ( $script eq $self->build_script ) { + $opts{ntargs} = q(-x -S %0 --build_bat %*); + $opts{otherargs} = q(-x -S "%0" --build_bat %1 %2 %3 %4 %5 %6 %7 %8 %9); + } + + my $out = eval {$self->pl2bat(in => $script, update => 1, %opts)}; + if ( $@ ) { + $self->log_warn("WARNING: Unable to convert file '$script' to an executable script:\n$@"); + } else { + $self->SUPER::make_executable($out); + } } } } |