Extract dependencies from tests.

This commit is contained in:
stevenpritchard
2009-01-22 01:48:06 +00:00
parent 5ab6da388b
commit 1e000c55ac
3 changed files with 29 additions and 2 deletions

View File

@@ -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,

View File

@@ -1,3 +1,7 @@
1.79
* Extract dependencies from tests.
1.78 2009-01-16
* Fix up the license list some more.

View File

@@ -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;