Skip Menu |
 

This queue is for tickets about the Module-Depends CPAN distribution.

Report information
The Basics
Id: 64016
Status: new
Priority: 0/
Queue: Module-Depends

People
Owner: Nobody in particular
Requestors: gregoa [...] cpan.org
Cc: dam [...] cpan.org
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)

Attachments


Subject: Support for configure_requires and test_requires
Download (untitled) / with headers
text/plain 158b
(Debian bug http://bugs.debian.org/541165 ) Find attached a patch to add support for configure_requires and test_requires. Cheers, gregor, Debian Perl Group
Subject: configure_test_requires.patch
Description: add support for test_requires and configure_requires Origin: vendor Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=541165 Forwarded: no Author: Ryan Niebur <ryan@debian.org> Reviewed-by: gregor herrmann <gregoa@debian.org> Last-Update: 2010-11-17 --- a/lib/Module/Depends.pm +++ b/lib/Module/Depends.pm @@ -3,7 +3,7 @@ use YAML::XS qw/LoadFile/; use Cwd qw( getcwd ); use base qw( Class::Accessor::Chained ); -__PACKAGE__->mk_accessors(qw( dist_dir debug libs requires build_requires error )); +__PACKAGE__->mk_accessors(qw( dist_dir debug libs requires build_requires test_requires configure_requires error )); our $VERSION = '0.15'; =head1 NAME @@ -41,6 +41,8 @@ libs => [], requires => {}, build_requires => {}, + test_requires => {}, + configure_requires => {}, error => '', }); } @@ -51,7 +53,7 @@ =head2 find_modules -scan the C<dist_dir> to populate C<libs>, C<requires>, and C<build_requires> +scan the C<dist_dir> to populate C<libs>, C<requires>, C<configure_requires>, C<test_requires>, and C<build_requires> =cut @@ -78,6 +80,8 @@ my $meta = LoadFile( $file ); $self->requires( $meta->{requires} ); $self->build_requires( $meta->{build_requires} ); + $self->configure_requires( $meta->{configure_requires} ); + $self->test_requires( $meta->{test_requires} ); } else { $self->error( "No META.yml found in ". $self->dist_dir ); --- a/lib/Module/Depends/Intrusive.pm +++ b/lib/Module/Depends/Intrusive.pm @@ -32,6 +32,8 @@ my %args = @_; $self->requires( $args{requires} || {} ); $self->build_requires( $args{build_requires} || {} ); + $self->test_requires( $args{test_requires} || {} ); + $self->configure_requires( $args{configure_requires} || {} ); bless {}, "Module::Depends::Intrusive::Fake::Module::Build"; }; local *Module::Build::subclass = sub { 'Module::Build' }; @@ -40,6 +42,7 @@ my $WriteMakefile = sub { my %args = @_; $self->requires( $args{PREREQ_PM} || {} ); + $self->build_requires ( $args{BUILD_REQUIRES} || {} ); 1; }; local *main::WriteMakefile; @@ -61,7 +64,7 @@ all_from auto_install AUTOLOAD build_requires check_nmake include include_deps installdirs Makefile makemaker_args Meta name no_index requires WriteAll clean_files can_cc sign cc_inc_paths cc_files - cc_optimize_flags author license + cc_optimize_flags author license configure_requires test_requires ); local *inc::Module::Install::AUTOLOAD = sub { 1 }; @@ -74,6 +77,14 @@ my %deps = (@_ == 1 ? ( $_[0] => 0 ) : @_); $self->build_requires->{ $_ } = $deps{ $_ } for keys %deps; }; + local *inc::Module::Install::test_requires = sub { + my %deps = (@_ == 1 ? ( $_[0] => 0 ) : @_); + $self->test_requires->{ $_ } = $deps{ $_ } for keys %deps; + }; + local *inc::Module::Install::configure_requires = sub { + my %deps = (@_ == 1 ? ( $_[0] => 0 ) : @_); + $self->configure_requires->{ $_ } = $deps{ $_ } for keys %deps; + }; my $file = File::Spec->catfile( getcwd(), $pl ); eval { --- a/t/depends.t +++ b/t/depends.t @@ -1,7 +1,7 @@ #!perl use strict; use warnings; -use Test::More tests => 20; +use Test::More tests => 21; my $class = 'Module::Depends::Intrusive'; require_ok("Module::Depends"); require_ok($class); @@ -68,6 +68,12 @@ is_deeply( $distant->requires, $our_requires, "got our own requires, non-intrusively, from a distance" ); +is_deeply( + $distant->test_requires, + { 'Test::Fatal' => 0 }, + "got our own test_requires, non-intrusively, from a distance" +); + my $json = Module::Depends->new->dist_dir('t/with-json')->find_modules; is_deeply( $json->requires, $our_requires, "got our own requires, non-intrusively, from a distance" ); --- a/t/with-yaml/META.yml +++ b/t/with-yaml/META.yml @@ -11,6 +11,8 @@ YAML: 0 build_requires: Test::More: 0 +test_requires: + Test::Fatal: 0 provides: Module::Depends: file: lib/Module/Depends.pm
Newer patch for both #64017 and #64016 added to #64017.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.