[Po4a-commits] r2694 - in /trunk: Po4aBuilder.pm po4a-updatepo
barbier at users.alioth.debian.org
barbier at users.alioth.debian.org
Wed Oct 31 21:21:15 UTC 2012
Author: barbier
Date: Wed Oct 31 21:21:14 2012
New Revision: 2694
URL: http://svn.debian.org/wsvn/po4a/?sc=1&rev=2694
Log:
Replace several system() calls by their Perl counterpart
Modified:
trunk/Po4aBuilder.pm
trunk/po4a-updatepo
Modified: trunk/Po4aBuilder.pm
URL: http://svn.debian.org/wsvn/po4a/trunk/Po4aBuilder.pm?rev=2694&op=diff
==============================================================================
--- trunk/Po4aBuilder.pm (original)
+++ trunk/Po4aBuilder.pm Wed Oct 31 21:21:14 2012
@@ -1,8 +1,9 @@
package Po4aBuilder;
use Module::Build;
use File::Basename;
-use File::Path;
+use File::Path qw(mkpath);
use File::Spec;
+use File::Copy qw(copy);
use File::stat;
@ISA = qw(Module::Build);
@@ -48,8 +49,9 @@
my @all_files = (@perl_files, @shell_files);
unless ($self->up_to_date(\@all_files, "po/bin/po4a.pot")) {
print "XX Update po/bin/po4a-perl.pot\n";
+ chdir "po/bin";
$sources = join ("", map {" ../../".$_ } @perl_files);
- $cmd = "cd po/bin; xgettext ";
+ $cmd = "xgettext ";
$cmd .= "--from-code=utf-8 ";
$cmd .= "-L Perl ";
$cmd .= "--add-comments ";
@@ -62,7 +64,7 @@
print "XX Update po/bin/po4a-shell.pot\n";
$sources = join ("", map {" ../../".$_ } @shell_files);
- $cmd = "cd po/bin; xgettext ";
+ $cmd = "xgettext ";
$cmd .= "--from-code=utf-8 ";
$cmd .= "-L shell ";
$cmd .= "--add-comments ";
@@ -73,8 +75,9 @@
$cmd .= "-o po4a-shell.pot";
system($cmd) && die;
- $cmd = "msgcat po/bin/po4a-perl.pot po/bin/po4a-shell.pot -o po/bin/po4a.pot.new";
+ $cmd = "msgcat po4a-perl.pot po4a-shell.pot -o po4a.pot.new";
system($cmd) && die;
+ chdir "../..";
unlink "po/bin/po4a-perl.pot" || die;
unlink "po/bin/po4a-shell.pot" || die;
@@ -118,7 +121,7 @@
print "XX $_ uptodate.\n";
}
unless ($self->up_to_date($_,"blib/po/$lang/LC_MESSAGES/po4a.mo")) {
- File::Path::mkpath( File::Spec->catdir( 'blib', 'po', $lang, "LC_MESSAGES" ), 0, oct(777) );
+ mkpath( File::Spec->catdir( 'blib', 'po', $lang, "LC_MESSAGES" ), 0, oct(777) );
system("msgfmt -o blib/po/$lang/LC_MESSAGES/po4a.mo $_") && die;
}
}
@@ -194,16 +197,19 @@
$cmd .= $ENV{PO4AFLAGS}." " if defined($ENV{PO4AFLAGS});
$cmd .= "--previous po/pod.cfg";
system($cmd) and die;
- system("mkdir -p blib/man/man7") and die;
- system("mkdir -p blib/man/man1") and die;
- system("cp doc/po4a.7.pod blib/man/man7") and die;
+ my $manpath = File::Spec->catdir( 'blib', 'man' );
+ my $man1path = File::Spec->catdir( $manpath, 'man1' );
+ my $man7path = File::Spec->catdir( $manpath, 'man7' );
+ File::Path::mkpath( $man1path, 0, oct(777) ) or die;
+ File::Path::mkpath( $man7path, 0, oct(777) ) or die;
+ copy ( File::Spec->catdir("doc", "po4a.7.pod"), $man7path) or die;
foreach $file (perl_scripts()) {
$file =~ m,([^/]*)$,;
- system ("cp $file blib/man/man1/$1.1p.pod") and die;
- }
- $self->delete_filetree("blib/bindoc") || die;
-
- foreach $file (@{$self->rscan_dir('blib/man',qr{\.pod$})}) {
+ copy($file, File::Spec->catdir($man1path, "$1.1p.pod")) or die;
+ }
+ $self->delete_filetree( File::Spec->catdir("blib", "bindoc") ) || die;
+
+ foreach $file (@{$self->rscan_dir($manpath, qr{\.pod$})}) {
next if $file =~ m/^man7/;
my $out = $file;
$out =~ s/\.pod$//;
@@ -239,8 +245,10 @@
}
# Install the manpages written in XML DocBook
- system ("cp share/doc/po4a-build.xml share/doc/po4aman-display-po.xml share/doc/po4apod-display-po.xml blib/man/man1/") and die;
- foreach $file (@{$self->rscan_dir('blib/man',qr{\.xml$})}) {
+ foreach $file (qw(po4a-build.xml po4aman-display-po.xml po4apod-display-po.xml)) {
+ copy ( File::Spec->catdir("share", "doc", $file), $man1path) or die;
+ }
+ foreach $file (@{$self->rscan_dir($manpath, qr{\.xml$})}) {
if ($file =~ m,(.*/man(.))/([^/]*)\.xml$,) {
my ($outdir, $section, $outfile) = ($1, $2, $3);
system("xsltproc -o $outdir/$outfile.$section --nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $file") and die;
@@ -253,9 +261,9 @@
sub ACTION_postats {
my $self = shift;
$self->depends_on('binpo');
- $self->postats("po/bin");
- $self->postats("po/pod");
- $self->postats("po/www") if -d "po/www";
+ $self->postats( File::Spec->catdir("po", "bin"));
+ $self->postats( File::Spec->catdir("po", "pod"));
+ $self->postats( File::Spec->catdir("po", "www")) if -d File::Spec->catdir("po", "www");
}
sub postats {
Modified: trunk/po4a-updatepo
URL: http://svn.debian.org/wsvn/po4a/trunk/po4a-updatepo?rev=2694&op=diff
==============================================================================
--- trunk/po4a-updatepo (original)
+++ trunk/po4a-updatepo Wed Oct 31 21:21:14 2012
@@ -174,6 +174,7 @@
use Pod::Usage qw(pod2usage);
use File::Temp;
+use File::Copy qw(copy);
Locale::Po4a::Common::textdomain('po4a');
@@ -281,7 +282,7 @@
} else {
print STDERR wrap_msg(gettext("Creating %s:"), $po_filename)
if $verbose;
- system ("cp",$pot_filename,$po_filename) == 0
+ copy ($pot_filename,$po_filename)
or die wrap_msg(gettext("Error while copying the PO file: %s"), $!);
}
}
More information about the Po4a-commits
mailing list