[Po4a-commits] r2697 - in /trunk: po4a po4a-updatepo

barbier at users.alioth.debian.org barbier at users.alioth.debian.org
Wed Oct 31 21:21:27 UTC 2012


Author: barbier
Date: Wed Oct 31 21:21:27 2012
New Revision: 2697

URL: http://svn.debian.org/wsvn/po4a/?sc=1&rev=2697
Log:
Add $Config{_exe} to executable name in system() calls

Modified:
    trunk/po4a
    trunk/po4a-updatepo

Modified: trunk/po4a
URL: http://svn.debian.org/wsvn/po4a/trunk/po4a?rev=2697&op=diff
==============================================================================
--- trunk/po4a (original)
+++ trunk/po4a Wed Oct 31 21:21:27 2012
@@ -593,6 +593,7 @@
 use File::Spec;
 use Fcntl; # sysopen flags
 use Cwd; # cwd
+use Config;
 
 Locale::Po4a::Common::textdomain('po4a');
 
@@ -1270,7 +1271,7 @@
                 or die wrap_msg(gettext("Can't create directory '%s': %s"),
                                 $dir, $!);
         }
-        my $cmd = "msggrep -N '$master' -o ".
+        my $cmd = "msggrep".$Config{_exe}." -N '$master' -o ".
                   ($po4a_opts{"force"}?$split_pot{$master}:$tmp_file).
                   " $pot_filename";
         run_cmd($cmd);
@@ -1303,7 +1304,7 @@
             $split_po{$lang}{$master} = $master_po;
         }
         if (length $cmd_cat) {
-            $cmd_cat = "msgcat -o $tmp_bigpo $cmd_cat";
+            $cmd_cat = "msgcat".$Config{_exe}." -o $tmp_bigpo $cmd_cat";
             run_cmd($cmd_cat);
         }
         # We do not need to keep the original name with $master
@@ -1322,15 +1323,15 @@
             if ($po4a_opts{"verbose"});
         my $msgmerge_opt = $po4a_opts{"msgmerge-opt"};
         $msgmerge_opt =~ s/\$lang\b/$lang/g if scalar @langs;
-        my $cmd = "msgmerge -U ".$po_filename{$lang}." $pot_filename ".$msgmerge_opt." --backup=none";
+        my $cmd = "msgmerge".$Config{_exe}." -U ".$po_filename{$lang}." $pot_filename ".$msgmerge_opt." --backup=none";
         run_cmd($cmd);
-        my @cmd = ("msgfmt", "--statistics", "-v", "-o", File::Spec->devnull(), $po_filename{$lang});
+        my @cmd = ("msgfmt".$Config{_exe}, "--statistics", "-v", "-o", File::Spec->devnull(), $po_filename{$lang});
         system (@cmd)
             if $po4a_opts{"verbose"};
     } else {
         print wrap_msg(gettext("Creating %s:"), $po_filename{$lang})
             if $po4a_opts{"verbose"};
-        my $cmd = "msginit -i $pot_filename --locale $lang -o ".$po_filename{$lang}." --no-translator";
+        my $cmd = "msginit".$Config{_exe}." -i $pot_filename --locale $lang -o ".$po_filename{$lang}." --no-translator";
         run_cmd($cmd);
     }
     chdir $po4a_opts{"calldir"}
@@ -1363,11 +1364,11 @@
             # Create an empty PO or copy the original PO header.
             # This permits to keep the header.
             if (-f $split_po{$lang}{$master}) {
-                $cmd = "msggrep --force-po -v -K -e '.'".
+                $cmd = "msggrep".$Config{_exe}." --force-po -v -K -e '.'".
                        " -o ".$tmp_file.
                        " ".$split_po{$lang}{$master};
             } else {
-                $cmd = "msginit --no-translator -l ".$lang.
+                $cmd = "msginit".$Config{_exe}." --no-translator -l ".$lang.
                        " -i ".$split_pot{$master}.
                        " -o ".$tmp_file;
             }
@@ -1375,7 +1376,7 @@
 
             # Update the PO according to the new POT and to the big PO
             # (compendium).
-            $cmd = "msgmerge -U -C ".$po_filename{$lang}.
+            $cmd = "msgmerge".$Config{_exe}." -U -C ".$po_filename{$lang}.
                    " --backup=none ".$po4a_opts{"msgmerge-opt"}.
                    " $tmp_file ".$split_pot{$master};
             run_cmd($cmd);

Modified: trunk/po4a-updatepo
URL: http://svn.debian.org/wsvn/po4a/trunk/po4a-updatepo?rev=2697&op=diff
==============================================================================
--- trunk/po4a-updatepo (original)
+++ trunk/po4a-updatepo Wed Oct 31 21:21:27 2012
@@ -175,6 +175,7 @@
 
 use File::Temp;
 use File::Copy qw(copy);
+use Config;
 
 Locale::Po4a::Common::textdomain('po4a');
 
@@ -224,6 +225,7 @@
 pod2usage () if scalar @masterfiles < 1 || scalar @pofiles < 1;
 
 $msgmerge_opt .= " --previous" unless $noprevious;
+$msgmerge_opt =~ s/^\s+//;
 
 my %options = (
     "verbose"            => $verbose,
@@ -274,10 +276,12 @@
     if (-e $po_filename) {
         print STDERR wrap_msg(gettext("Updating %s:"), $po_filename)
           if $verbose;
-        my @cmd = ("msgmerge", $msgmerge_opt, "-U", $po_filename, $pot_filename);
+        my @cmd = ("msgmerge".$Config{_exe});
+        push (@cmd, split(/\s+/, $msgmerge_opt)) if length($msgmerge_opt);
+        push @cmd, ("-U", $po_filename, $pot_filename);
         system (@cmd) == 0
           or die wrap_msg(gettext("Error while running msgmerge: %s"), $!);
-        @cmd = ("msgfmt", "--statistics", "-v", "-o", File::Spec->devnull(), $po_filename);
+        @cmd = ("msgfmt".$Config{_exe}, "--statistics", "-v", "-o", File::Spec->devnull(), $po_filename);
         system (@cmd)
           if $verbose;
     } else {




More information about the Po4a-commits mailing list