Change 28579 by [EMAIL PROTECTED] on 2006/07/15 14:46:53
Upgrade to Module-Build-0.2802
Affected files ...
... //depot/perl/lib/Module/Build.pm#6 edit
... //depot/perl/lib/Module/Build/Base.pm#6 edit
... //depot/perl/lib/Module/Build/Changes#6 edit
... //depot/perl/lib/Module/Build/ModuleInfo.pm#3 edit
... //depot/perl/lib/Module/Build/t/moduleinfo.t#2 edit
... //depot/perl/lib/Module/Build/t/runthrough.t#3 edit
Differences ...
==== //depot/perl/lib/Module/Build.pm#6 (text) ====
Index: perl/lib/Module/Build.pm
--- perl/lib/Module/Build.pm#5~28495~ 2006-07-06 08:38:51.000000000 -0700
+++ perl/lib/Module/Build.pm 2006-07-15 07:46:53.000000000 -0700
@@ -15,7 +15,7 @@
use vars qw($VERSION @ISA);
@ISA = qw(Module::Build::Base);
-$VERSION = '0.2801';
+$VERSION = '0.2802';
$VERSION = eval $VERSION;
# Okay, this is the brute-force method of finding out what kind of
==== //depot/perl/lib/Module/Build/Base.pm#6 (text) ====
Index: perl/lib/Module/Build/Base.pm
--- perl/lib/Module/Build/Base.pm#5~28495~ 2006-07-06 08:38:51.000000000
-0700
+++ perl/lib/Module/Build/Base.pm 2006-07-15 07:46:53.000000000 -0700
@@ -499,9 +499,8 @@
my $ans = $self->_readline();
- if ( !defined($ans) ) { # Ctrl-D
- print "\n";
- } elsif ( !length($ans) ) { # Default
+ if ( !defined($ans) # Ctrl-D or unattended
+ or !length($ans) ) { # User hit return
print "$def\n";
$ans = $def;
}
@@ -1233,10 +1232,8 @@
sub compare_versions {
my $self = shift;
my ($v1, $op, $v2) = @_;
-
- # for alpha versions - this doesn't cover all cases, but should work for
most:
- $v1 =~ s/_(\d+)\z/$1/;
- $v2 =~ s/_(\d+)\z/$1/;
+ $v1 = Module::Build::Version->new($v1)
+ unless UNIVERSAL::isa($v1,'Module::Build::Version');
my $eval_str = "\$v1 $op \$v2";
my $result = eval $eval_str;
@@ -2444,6 +2441,7 @@
foreach my $spec (@$dirs) {
my $dir = $self->localize_dir_path($spec);
next unless -e $dir;
+
FILE: foreach my $file ( @{ $self->rscan_dir( $dir ) } ) {
foreach my $regexp ( @{ $args{exclude} } ) {
next FILE if $file =~ $regexp;
==== //depot/perl/lib/Module/Build/Changes#6 (text) ====
Index: perl/lib/Module/Build/Changes
--- perl/lib/Module/Build/Changes#5~28495~ 2006-07-06 08:38:51.000000000
-0700
+++ perl/lib/Module/Build/Changes 2006-07-15 07:46:53.000000000 -0700
@@ -1,5 +1,17 @@
Revision history for Perl extension Module::Build.
+0.2802 Fri Jul 14 22:40:34 CDT 2006
+
+ - Added reliance on version.pm, which means we should deal much
+ better with the wide range of version specifications one finds on
+ CPAN. This is made possible by recent releases of version.pm that
+ give the user a pure-perl option, so installing version.pm
+ shouldn't be too onerous for most users. [John Peacock]
+
+ - We should be accepting the default when we're in unattended mode,
+ not acting dumb and ignoring both the default and the [empty]
+ answer from the user. Fixed. [Spotted by Nik Clayton]
+
0.2801 Sun May 21 00:07:40 CDT 2006
- Module::Build::Compat's emulation of INC is incorrectly prepending
==== //depot/perl/lib/Module/Build/ModuleInfo.pm#3 (text) ====
Index: perl/lib/Module/Build/ModuleInfo.pm
--- perl/lib/Module/Build/ModuleInfo.pm#2~27997~ 2006-04-28
06:29:41.000000000 -0700
+++ perl/lib/Module/Build/ModuleInfo.pm 2006-07-15 07:46:53.000000000 -0700
@@ -8,6 +8,7 @@
use File::Spec;
use IO::File;
+use Module::Build::Version;
my $PKG_REGEXP = qr/ # match a package declaration
@@ -283,23 +284,14 @@
$line
}; \$$var
};
- local $^W;
-
- # version.pm will change the ->VERSION method, so we mitigate the
- # potential effects here. Unfortunately local(*UNIVERSAL::VERSION)
- # will crash perl < 5.8.1. We also use * Foo::VERSION instead of
- # *Foo::VERSION so that old versions of CPAN.pm, etc. with a
- # too-permissive regex don't think we're actually declaring a
- # version.
- my $old_version = \&UNIVERSAL::VERSION;
- eval {require version};
+ local $^W;
+ # Try and get the $VERSION
my $result = eval $eval;
- * UNIVERSAL::VERSION = $old_version;
warn "Error evaling version line '$eval' in $self->{filename}: [EMAIL
PROTECTED]" if $@;
- # Unbless it if it's a version.pm object
- $result = $result->numify if UNIVERSAL::isa($result, 'version');
+ # Bless it into our own version class
+ $result = Module::Build::Version->new($result);
return $result;
}
==== //depot/perl/lib/Module/Build/t/moduleinfo.t#2 (text) ====
Index: perl/lib/Module/Build/t/moduleinfo.t
--- perl/lib/Module/Build/t/moduleinfo.t#1~27389~ 2006-03-06
08:09:50.000000000 -0800
+++ perl/lib/Module/Build/t/moduleinfo.t 2006-07-15 07:46:53.000000000
-0700
@@ -2,7 +2,7 @@
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 66;
+use MBTest tests => 72;
use Cwd ();
my $cwd = Cwd::cwd;
@@ -163,6 +163,15 @@
our $VERSION = "1.23";
---
+ <<'---', # $VERSION using version.pm
+ package Simple;
+ use version; our $VERSION = version->new('1.23');
+---
+ <<'---', # $VERSION using version.pm and qv()
+ package Simple;
+ use version; our $VERSION = qv('1.230');
+---
+
);
my( $i, $n ) = ( 1, scalar( @modules ) );
@@ -178,7 +187,7 @@
local $SIG{__WARN__} = sub { $warnings .= $_ for @_ };
my $pm_info = Module::Build::ModuleInfo->new_from_file( $file );
- is( $pm_info->version, '1.23',
+ cmp_ok( $pm_info->version, '==', '1.23',
"correct module version ($i of $n)" );
is( $warnings, '', 'no warnings from parsing' );
$i++;
@@ -223,6 +232,26 @@
is( $pm_info->name, undef, 'no default package' );
is( $pm_info->version, undef, 'no version w/o default package' );
+# Module 'Simple.pm' contains an alpha version
+# constructor should report first $VERSION found
+$dist->change_file( 'lib/Simple.pm', <<'---' );
+package Simple;
+$VERSION = '1.23_01';
+$VERSION = eval $VERSION;
+---
+
+$dist->regen;
+$pm_info = Module::Build::ModuleInfo->new_from_file( $file );
+
+is( $pm_info->version, '1.23_01', 'alpha version reported');
+
+# NOTE the following test has be done this way because Test::Builder is
+# too smart for our own good and tries to see if the version object is a
+# dual-var, which breaks with alpha versions:
+# Argument "1.23_0100" isn't numeric in addition (+) at
+# /usr/lib/perl5/5.8.7/Test/Builder.pm line 505.
+
+ok( $pm_info->version > 1.23, 'alpha version greater than non');
# revert to pristine state
chdir( $cwd ) or die "Can''t chdir to '$cwd': $!";
==== //depot/perl/lib/Module/Build/t/runthrough.t#3 (text) ====
Index: perl/lib/Module/Build/t/runthrough.t
--- perl/lib/Module/Build/t/runthrough.t#2~28495~ 2006-07-06
08:38:51.000000000 -0700
+++ perl/lib/Module/Build/t/runthrough.t 2006-07-15 07:46:53.000000000
-0700
@@ -201,7 +201,7 @@
$dist->remove;
SKIP: {
- skip( 'Windows only test', 4 ) unless $^O =~ /^MSWin/;
+ skip( 'Windows-only test', 4 ) unless $^O =~ /^MSWin/;
my $script_data = <<'---';
@echo off
End of Patch.