[Module-build-checkins] Module-Build/lib/Module/Build Base.pm,1.502,1.503
Status: Beta
Brought to you by:
kwilliams
From: Randy W. S. <si...@us...> - 2005-10-23 02:18:35
|
Update of /cvsroot/module-build/Module-Build/lib/Module/Build In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8898/lib/Module/Build Modified Files: Base.pm Log Message: Removed the gen_manpages, gen_html, install_manpages, install_html properties that were a failed attempt to provide user control of generation of documentation in favor of method introduced below. Introduced two actions: html & manpages that will generate documentation for POD when the respective feature is enabled. The actions will generate the documents even if there is no set place to install to. However, if the actions are invoked as a dependency of another action (e.g. build), the documentation will only be built when there is a default place to install to. Index: Base.pm =================================================================== RCS file: /cvsroot/module-build/Module-Build/lib/Module/Build/Base.pm,v retrieving revision 1.502 retrieving revision 1.503 diff -u -d -r1.502 -r1.503 --- Base.pm 20 Oct 2005 16:45:19 -0000 1.502 +++ Base.pm 23 Oct 2005 02:18:15 -0000 1.503 @@ -72,6 +72,7 @@ $self->cull_args(@ARGV); $self->{action} ||= 'build'; + $self->{invoked_action} = $self->{action}; return $self; } @@ -283,17 +284,6 @@ }, }; - - my $installdirs = $p->{installdirs}; - - $p->{gen_manpages} ||= ( $p->{install_sets}{$installdirs}{bindoc} && - $p->{install_sets}{$installdirs}{libdoc} ) ? 1 : 0; - $p->{gen_html} ||= ( $p->{install_sets}{$installdirs}{binhtml} && - $p->{install_sets}{$installdirs}{libhtml} ) ? 1 : 0; - - $p->{install_manpages} ||= $p->{gen_manpages} ? 1 : 0; - $p->{install_html} ||= $p->{gen_html} ? 1 : 0; - } sub _find_nested_builds { @@ -398,6 +388,7 @@ } sub current_action { shift->{action} } +sub invoked_action { shift->{invoked_action} } sub notes { shift()->{phash}{notes}->access(@_) } sub config_data { shift()->{phash}{config_data}->access(@_) } @@ -581,12 +572,6 @@ __PACKAGE__->add_property(metafile => 'META.yml'); __PACKAGE__->add_property(use_rcfile => 1); -__PACKAGE__->add_property($_ => 0) for qw( - gen_manpages - gen_html - install_manpages - install_html -); __PACKAGE__->add_property($_) for qw( base_dir dist_name @@ -1227,7 +1212,8 @@ if (@_) { my ($action, %p) = @_; my $args = $p{args} ? delete($p{args}) : {}; - + + local $self->{invoked_action} = $action; local $self->{args} = {%{$self->{args}}, %$args}; local $self->{properties} = {%{$self->{properties}}, %p}; return $self->_call_action($action); @@ -1348,10 +1334,6 @@ html_css meta_add meta_merge - gen_manpages - gen_html - install_manpages - install_html test_files install_base create_makefile_pl @@ -1388,10 +1370,6 @@ $opt = $self->_translate_option($opt); my @bool_opts = qw( - gen_manpages - gen_html - install_manpages - install_html verbose create_readme pollute @@ -2097,15 +2075,28 @@ my $self = shift; $self->depends_on('code'); + $self->depends_on('manpages', 'html'); +} - if ( $self->_mb_feature('manpage_support') && - $self->gen_manpages ) - { +sub ACTION_manpages { + my $self = shift; + + if ( $self->invoked_action ne 'manpages' ) { + foreach my $type ( qw(bin lib) ) { + my $files = $self->_find_pods( $self->{properties}{"${type}doc_dirs"}, + exclude => [ qr/\.bat$/ ] ); + return if !%$files || + (%$files && !$self->install_destination("${type}doc")); + + } + } + + $self->depends_on('code'); + + if ( $self->_mb_feature('manpage_support') ) { $self->manify_bin_pods; $self->manify_lib_pods; } - - $self->htmlify_pods if $self->gen_html; } sub manify_bin_pods { @@ -2179,10 +2170,22 @@ sub ACTION_html { my $self = shift; + + if ( $self->invoked_action ne 'html' ) { + foreach my $type ( qw(bin lib) ) { + my $files = $self->_find_pods( $self->{properties}{"${type}doc_dirs"}, + exclude => [ qr/\.(?:bat|com|html)$/ ] ); + return if !%$files || + (%$files && !$self->install_destination("${type}html")); + } + } + $self->depends_on('code'); - $self->htmlify_pods; + + $self->htmlify_pods if $self->_mb_feature('HTML_support'); } + # XXX This is wrong, wrong, wrong. # 1) It assumes installation into site directories # 2) If it's an ActiveState perl install, we need to run @@ -3141,17 +3144,6 @@ sub install_types { my $self = shift; my %types = (%{$self->install_path}, %{ $self->install_sets->{$self->installdirs} }); - - unless ( $self->gen_html && $self->install_html ) { - delete( $types{binhtml} ); - delete( $types{libhtml} ); - } - - unless ( $self->gen_manpages && $self->install_manpages ) { - delete( $types{bindoc} ); - delete( $types{libdoc} ); - } - return sort keys %types; } @@ -3164,12 +3156,13 @@ my $localdir = File::Spec->catdir( $blib, $type ); next unless -e $localdir; - if (my $dest = $self->install_destination($type)) { + if (my $dest = $self->install_destination($type) ) { $map{$localdir} = $dest; } else { - # Platforms like Win32, MacOS, etc. may not build man pages + # Platforms like Win32, MacOS, etc. may not build man pages & + # Many platforms don't supply default locations for html docs die "Can't figure out where to install things of type '$type'" - unless $type =~ /^(lib|bin)doc$/; + unless $type =~ /^(lib|bin)(doc|html)$/; } } |