[svn:Module-Build] r12932 - in Module-Build/trunk: . lib/Module/Build t

[email protected]
Newsgroups perl.module.build.checkins
Message-ID <[email protected]>
Author: dagolden
Date: Sat Jun 27 12:47:28 2009
New Revision: 12932

Modified:
   Module-Build/trunk/Changes
   Module-Build/trunk/lib/Module/Build/API.pod
   Module-Build/trunk/lib/Module/Build/Base.pm
   Module-Build/trunk/t/metadata.t

Log:
Added auto_configure_requires parameter

Also removed checks that configure_requires are in requires or build_requires
as this is not always necessary


Modified: Module-Build/trunk/Changes
==============================================================================
--- Module-Build/trunk/Changes	(original)
+++ Module-Build/trunk/Changes	Sat Jun 27 12:47:28 2009
@@ -2,12 +2,22 @@
 
 0.33_05 - 
 
+ Enhancements:
+ - New 'auto_configure_requires' parameter (default 1) controls
+   whether Module::Build should add itself to configure_requires
+   in META.yml if not specified in Build.PL [David Golden]
+
+ Other:
+ - configure_requires do not necessarily need to be in requires
+   or build_requires; warning to that effect has been removed
+   [David Golden]
+
 0.33_04 - Fri Jun 26 07:09:06 EDT 2009
 
  Bug-fixes:
  - Don't try utf8 YAML I/O on Perl 5.6 [David Golden]
 
- Other
+ Other:
  - configure_requires added to prereq report (RT#47254) [Curtis Jewell]
  - updated Module::Build::Version to match forthcoming version.pm 0.77
    (RT#47256) [John Peacock]

Modified: Module-Build/trunk/lib/Module/Build/API.pod
==============================================================================
--- Module-Build/trunk/lib/Module/Build/API.pod	(original)
+++ Module-Build/trunk/lib/Module/Build/API.pod	Sat Jun 27 12:47:28 2009
@@ -72,6 +72,14 @@
 is performed. See also the L<add_to_cleanup()|/"add_to_cleanup(@files)">
 method.
 
+=item auto_configure_requires
+
+[version 0.34]
+
+This parameter determines whether Module::Build will add itself
+automatically to configure_requires (and build_requires) if Module::Build
+is not already there.  The default value is true.
+
 =item auto_features
 
 [version 0.26]

Modified: Module-Build/trunk/lib/Module/Build/Base.pm
==============================================================================
--- Module-Build/trunk/lib/Module/Build/Base.pm	(original)
+++ Module-Build/trunk/lib/Module/Build/Base.pm	Sat Jun 27 12:47:28 2009
@@ -824,6 +824,7 @@
 ########################################################################
 
 # Add the default properties.
+__PACKAGE__->add_property(auto_configure_requires => 1);
 __PACKAGE__->add_property(blib => 'blib');
 __PACKAGE__->add_property(build_class => 'Module::Build');
 __PACKAGE__->add_property(build_elements => [qw(PL support pm xs pod script)]);
@@ -3687,15 +3688,6 @@
     # XXX we are silently omitting the url for any unknown license
   }
 
-  if (exists $p->{configure_requires}) {
-    foreach my $spec (keys %{$p->{configure_requires}}) {
-      warn ("Warning: $spec is listed in 'configure_requires', but ".
-            "it is not found in any of the other prereq fields.\n")
-        unless grep exists $p->{$_}{$spec}, 
-              grep !/conflicts$/, @{$self->prereq_action_types};
-    }
-  }
-
   # copy prereq data structures so we can modify them before writing to META
   my %prereq_types;
   for my $type ( 'configure_requires', @{$self->prereq_action_types} ) {
@@ -3708,13 +3700,12 @@
   }
 
   # add current Module::Build to configure_requires if there 
-  # isn't a configure_requires already specified
+  # isn't one already specified (but not ourself, so we're not circular)
   if ( $self->dist_name ne 'Module-Build' 
-    && ! $prereq_types{'configure_requires'} 
+    && $self->auto_configure_requires
+    && ! exists $prereq_types{'configure_requires'}{'Module::Build'}
   ) {
-    for my $t ('configure_requires', 'build_requires') {
-      $prereq_types{$t}{'Module::Build'} = $VERSION;
-    }
+    $prereq_types{configure_requires}{'Module::Build'} = $VERSION;
   }
 
   for my $t ( keys %prereq_types ) {

Modified: Module-Build/trunk/t/metadata.t
==============================================================================
--- Module-Build/trunk/t/metadata.t	(original)
+++ Module-Build/trunk/t/metadata.t	Sat Jun 27 12:47:28 2009
@@ -74,7 +74,6 @@
   is_deeply $node->{author}, $metadata{dist_author};
   is $node->{license}, $metadata{license};
   is_deeply $node->{configure_requires}, $mb_prereq, 'Add M::B to configure_requires';
-  is_deeply $node->{build_requires}, $mb_prereq, 'Add M::B to build_requires';
   like $node->{generated_by}, qr{Module::Build};
   ok defined( $node->{'meta-spec'}{version} ),
       "'meta-spec' -> 'version' field present in META.yml";
@@ -84,6 +83,16 @@
   is_deeply $node->{resources}, $metadata{meta_add}{resources};
 }
 
+{
+  my $mb_prereq = { 'Module::Build' => 0 };
+  $mb->configure_requires( $mb_prereq );
+  my $node = $mb->prepare_metadata( {} );
+
+
+  # exists() doesn't seem to work here
+  is_deeply $node->{configure_requires}, $mb_prereq, 'Add M::B to configure_requires';
+}
+
 $dist->clean;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.