From: Chris W. <la...@us...> - 2004-09-27 20:04:16
|
Update of /cvsroot/openinteract/OpenInteract2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29735 Modified Files: build_docs Log Message: OIN-84: fix issues on Win32 for building documentation Index: build_docs =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/build_docs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** build_docs 21 Mar 2004 23:08:05 -0000 1.11 --- build_docs 27 Sep 2004 20:04:05 -0000 1.12 *************** *** 18,22 **** use File::Find; use File::Path; ! use File::Spec; use Getopt::Std; use PodView; --- 18,22 ---- use File::Find; use File::Path; ! use File::Spec::Functions qw( catdir catfile ); use Getopt::Std; use PodView; *************** *** 27,37 **** my $CWD = cwd; - my $BASE_DIR = '.'; my $MANUAL_DIR = 'doc'; my ( $HTML_DIR ); ! my $DEST_DIR = File::Spec->catdir( $CWD, 'site', 'working' ); my $DOC_EXT = $PodView::INTERNAL_DOC_EXT; ! my $LIB_DIR = File::Spec->catdir( $CWD, 'lib' ); my @LIB_FILES = (); --- 27,36 ---- my $CWD = cwd; my $BASE_DIR = '.'; my $MANUAL_DIR = 'doc'; my ( $HTML_DIR ); ! my $DEST_DIR = catdir( $CWD, 'site', 'working' ); my $DOC_EXT = $PodView::INTERNAL_DOC_EXT; ! my $LIB_DIR = catdir( $CWD, 'lib' ); my @LIB_FILES = (); *************** *** 49,54 **** $PodView::INTERNAL_DOC_PATH = $opts{p}; } ! $HTML_DIR = File::Spec->catdir( $CWD, 'site', ! $PodView::INTERNAL_DOC_PATH ); # Grab the relevant .pm files from the manifest and extract the --- 48,55 ---- $PodView::INTERNAL_DOC_PATH = $opts{p}; } ! $HTML_DIR = catdir( $CWD, 'site', $PodView::INTERNAL_DOC_PATH ); ! ! $DEBUG && warn "Using directories [CWD: $CWD] [DEST: $DEST_DIR] ", ! "[LIB: $LIB_DIR] [HTML: $HTML_DIR]\n"; # Grab the relevant .pm files from the manifest and extract the *************** *** 67,80 **** PMFILE: foreach my $pm_file ( @LIB_FILES ) { ! ( $DEBUG > 1 ) && warn "Trying PM [$pm_file]\n"; my $name = $pm_file; $name =~ s|^lib/||; $name =~ s/\.pm$//; ! $name =~ s|/|::|g; my $pom = eval { $pm_parser->parse_file( $pm_file ) ! || die "Cannot parse [$pm_file]: ", $pm_parser->error(), "\n"; }; if ( $@ ) { --- 68,81 ---- PMFILE: foreach my $pm_file ( @LIB_FILES ) { ! ( $DEBUG > 1 ) && warn "Trying PM '$pm_file'\n"; my $name = $pm_file; $name =~ s|^lib/||; $name =~ s/\.pm$//; ! $name =~ s|[/\\]|::|g; my $pom = eval { $pm_parser->parse_file( $pm_file ) ! || die "Cannot parse '$pm_file': ", $pm_parser->error(), "\n"; }; if ( $@ ) { *************** *** 94,107 **** my $relative_pm_file = $pm_file; ! $relative_pm_file =~ s|^lib/||; ! my $dest_pod_file = File::Spec->catfile( $DEST_DIR, ! $relative_pm_file ); $dest_pod_file =~ s/\.pm$/.pod/; check_path( $dest_pod_file ); ! open( MODPOD, "> $dest_pod_file" ) ! || die "Cannot open [$dest_pod_file]: $!"; print MODPOD $pom; close( MODPOD ); ! $DEBUG && warn "Extrated POD from [$pm_file] to [$dest_pod_file] ok\n"; push @site_pod_files, $dest_pod_file; } --- 95,107 ---- my $relative_pm_file = $pm_file; ! $relative_pm_file =~ s|^lib[\\/]||; ! my $dest_pod_file = catfile( $DEST_DIR, $relative_pm_file ); $dest_pod_file =~ s/\.pm$/.pod/; check_path( $dest_pod_file ); ! open( MODPOD, '>', $dest_pod_file ) ! || die "Cannot open '$dest_pod_file': $!"; print MODPOD $pom; close( MODPOD ); ! $DEBUG && warn "Extracted POD from '$pm_file' to '$dest_pod_file' ok\n"; push @site_pod_files, $dest_pod_file; } *************** *** 126,132 **** # the output in the SPOPS tree AND in the site generation tree foreach my $orig_pod ( @MANUAL_FILES ) { my $new_pod = $orig_pod; ! $new_pod =~ s|^$MANUAL_DIR/|$DEST_DIR/OpenInteract2/|; check_path( $new_pod ); $template->process( $orig_pod, --- 126,138 ---- # the output in the SPOPS tree AND in the site generation tree + my $relocate_dest = $DEST_DIR; + $relocate_dest =~ s|\\|/|g; + my $relocate_lib = $LIB_DIR; + $relocate_lib =~ s|\\|/|g; + foreach my $orig_pod ( @MANUAL_FILES ) { my $new_pod = $orig_pod; ! $new_pod =~ s|^$MANUAL_DIR[\\/]||; ! $new_pod = catfile( $DEST_DIR, 'OpenInteract2', $new_pod ); check_path( $new_pod ); $template->process( $orig_pod, *************** *** 134,145 **** $new_pod ) || die $template->error(); ! $DEBUG && warn "Created manual file [$new_pod] ok\n"; push @site_pod_files, $new_pod; ! my $source_tree_pod = $new_pod; ! $source_tree_pod =~ s|$DEST_DIR/|$LIB_DIR/|; check_path( $source_tree_pod ); copy( $new_pod, $source_tree_pod ) ! || die "Failed to copy [$new_pod] -> [$source_tree_pod]: $!"; ! $DEBUG && warn "Copied created manual file to [$source_tree_pod] ok\n"; } --- 140,150 ---- $new_pod ) || die $template->error(); ! $DEBUG && warn "Created manual file '$new_pod' ok\n"; push @site_pod_files, $new_pod; ! my $source_tree_pod = relocate( $new_pod, $DEST_DIR, $LIB_DIR ); check_path( $source_tree_pod ); copy( $new_pod, $source_tree_pod ) ! || die "Failed to copy '$new_pod' -> '$source_tree_pod': $!"; ! $DEBUG && warn "Copied created manual file to '$source_tree_pod' ok\n"; } *************** *** 153,179 **** my $pom = $parser->parse_file( $site_pod_file ) || die $parser->error(), "\n"; ! my $dest_html_file = $site_pod_file; ! $dest_html_file =~ s/^$DEST_DIR/$HTML_DIR/; ! $dest_html_file =~ s/\.pod$/$DOC_EXT/; check_path( $dest_html_file ); ! open( SITE, "> $dest_html_file" ) ! || die "Cannot open [$dest_html_file]: $!"; my $title = $dest_html_file; ! $title =~ s|^$HTML_DIR/||; $title =~ s/$DOC_EXT$//; ! $title =~ s|/|::|g; print SITE header( $title ), $pom, footer( $VERSION ); close( SITE ); ! $DEBUG && warn "Generated HTML from [$site_pod_file] to [$dest_html_file] ok\n"; } # Finally, create the index page ! open( INDEXIN, "$MANUAL_DIR/index.html" ) ! || die "Cannot read index: $!"; ! open( INDEXOUT, "> $HTML_DIR/index$DOC_EXT" ) ! || die "Cannot open index for writing: $!"; print INDEXOUT header(), <INDEXIN>, footer( $VERSION ); close( INDEXOUT ); --- 158,184 ---- my $pom = $parser->parse_file( $site_pod_file ) || die $parser->error(), "\n"; ! my $dest_html_file = relocate( $site_pod_file, $DEST_DIR, $HTML_DIR ); check_path( $dest_html_file ); ! open( SITE, '>', $dest_html_file ) ! || die "Cannot open '$dest_html_file': $!"; my $title = $dest_html_file; ! $title =~ s|^$HTML_DIR\W||; $title =~ s/$DOC_EXT$//; ! $title =~ s|[\\/]|::|g; print SITE header( $title ), $pom, footer( $VERSION ); close( SITE ); ! $DEBUG && warn "Generated HTML from '$site_pod_file' to '$dest_html_file' ok\n"; } # Finally, create the index page ! my $index_in_file = catfile( $MANUAL_DIR, 'index.html' ); ! open( INDEXIN, '<', $index_in_file ) ! || die "Cannot read index from '$index_in_file': $!"; ! my $index_out_file = catfile( $HTML_DIR, "index$DOC_EXT" ); ! open( INDEXOUT, '>', $index_out_file ) ! || die "Cannot open index '$index_out_file' for writing: $!"; print INDEXOUT header(), <INDEXIN>, footer( $VERSION ); close( INDEXOUT ); *************** *** 181,186 **** } sub read_version { ! open( VER, 'VERSION' ) || die "Cannot open version doc: $!"; my $version = <VER>; chomp $version; --- 186,211 ---- } + sub relocate { + my ( $orig_location, $source_dir, $dest_dir ) = @_; + $orig_location =~ s|\\|/|g; + $source_dir =~ s|\\|/|g; + $dest_dir =~ s|\\|/|g; + my $new_location = $orig_location; + $new_location =~ s|^$source_dir|$dest_dir|; + if ( $orig_location eq $new_location ) { + die "A substitution didn't work property. We were supposed to relocate\n", + " $orig_location\n", + "from:\n", + " $source_dir\n", + "to:\n", + " $dest_dir\n", + "but it didn't work...\n"; + } + return $new_location; + } + + sub read_version { ! open( VER, '<', 'VERSION' ) || die "Cannot open version doc: $!"; my $version = <VER>; chomp $version; |