diff --git a/Build.PL b/Build.PL index 2efa8ab..0866b9b 100644 --- a/Build.PL +++ b/Build.PL @@ -16,6 +16,7 @@ my $builder = Module::Build->new( 'Getopt::Long' => 0, 'locale' => 0, 'LWP::UserAgent' => 0, + 'Module::ExtractUse' => 0, 'POSIX' => 0, 'Parse::CPAN::Packages' => 0, 'Pod::Simple::TextContent' => 0, diff --git a/Changes b/Changes index 91e4c5e..e54dbf2 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,7 @@ +1.79 + +* Extract dependencies from tests. + 1.78 2009-01-16 * Fix up the license list some more. diff --git a/cpanspec b/cpanspec index a4e9136..15b63e3 100755 --- a/cpanspec +++ b/cpanspec @@ -10,10 +10,10 @@ # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # -# $Id: cpanspec,v 1.67 2009/01/16 20:35:17 stevenpritchard Exp $ +# $Id: cpanspec,v 1.68 2009/01/22 01:48:06 stevenpritchard Exp $ our $NAME="cpanspec"; -our $VERSION='1.78'; +our $VERSION='1.79'; =head1 NAME @@ -882,6 +882,28 @@ for my $file (@args) { } $license="CHECK(GPL+ or Artistic)" if (!$license); + # Add build dependencies for modules used in tests. + my @tests=grep { + $_ eq "test.pl" + or $_ =~ /^t\/.*\.t$/ + } @files; + use Module::ExtractUse; + for my $testfile (@tests) { + my $extract_o_matic=Module::ExtractUse->new() + or die "Module::ExtractUse->new failed: $!\n"; + my $test=extract($archive, $type, $path . '/' . $testfile); + if (!defined($test)) { + warn "Failed to extract $testfile from $archive: $!\n"; + next; + } + $extract_o_matic->extract_use(\$test); + #print STDERR "$testfile: @{[$extract_o_matic->array()]}\n"; + for my $dep ($extract_o_matic->array()) { + next if ($dep eq $module); + $build_requires{$dep}=0; + } + } + my $usebuildpl=0; if (grep /^Build\.PL$/, @files) { $build_requires{'Module::Build'}=0;