From: Steve Peters Date: Sat, 15 Jul 2006 14:46:53 +0000 (+0000) Subject: Upgrade to Module-Build-0.2802 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b3dfda3362c68c1633be6b439e96cf2a84571d70;p=p5sagit%2Fp5-mst-13.2.git Upgrade to Module-Build-0.2802 p4raw-id: //depot/perl@28579 --- diff --git a/lib/Module/Build.pm b/lib/Module/Build.pm index 396add3..c58143c 100644 --- a/lib/Module/Build.pm +++ b/lib/Module/Build.pm @@ -15,7 +15,7 @@ use Module::Build::Base; 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 diff --git a/lib/Module/Build/Base.pm b/lib/Module/Build/Base.pm index bb17f66..3e7ebdb 100644 --- a/lib/Module/Build/Base.pm +++ b/lib/Module/Build/Base.pm @@ -499,9 +499,8 @@ EOF 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 check_installed_status { 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 @@ sub _find_pods { 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; diff --git a/lib/Module/Build/Changes b/lib/Module/Build/Changes index 1928c70..3547b49 100644 --- a/lib/Module/Build/Changes +++ b/lib/Module/Build/Changes @@ -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 diff --git a/lib/Module/Build/ModuleInfo.pm b/lib/Module/Build/ModuleInfo.pm index 18f0350..471f80b 100644 --- a/lib/Module/Build/ModuleInfo.pm +++ b/lib/Module/Build/ModuleInfo.pm @@ -8,6 +8,7 @@ use strict; use File::Spec; use IO::File; +use Module::Build::Version; my $PKG_REGEXP = qr/ # match a package declaration @@ -283,23 +284,14 @@ sub _evaluate_version_line { $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}: $@\n" 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; } diff --git a/lib/Module/Build/t/moduleinfo.t b/lib/Module/Build/t/moduleinfo.t index d8e0e0a..b056d13 100644 --- a/lib/Module/Build/t/moduleinfo.t +++ b/lib/Module/Build/t/moduleinfo.t @@ -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 @@ __PACKAGE__->mk_accessors(qw( 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 @@ foreach my $module ( @modules ) { 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 @@ $pm_info = Module::Build::ModuleInfo->new_from_file( $file ); 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': $!"; diff --git a/lib/Module/Build/t/runthrough.t b/lib/Module/Build/t/runthrough.t index 1e52b62..c2cfe86 100644 --- a/lib/Module/Build/t/runthrough.t +++ b/lib/Module/Build/t/runthrough.t @@ -201,7 +201,7 @@ chdir( $cwd ) or die "Can''t chdir to '$cwd': $!"; $dist->remove; SKIP: { - skip( 'Windows only test', 4 ) unless $^O =~ /^MSWin/; + skip( 'Windows-only test', 4 ) unless $^O =~ /^MSWin/; my $script_data = <<'---'; @echo off