[Gnucash-changes] r13079 - gnucash/trunk - Allow make-gnucash-potfiles to run from directories other than srcdir.

Chris Shoemaker chris at cvs.gnucash.org
Thu Feb 2 13:47:35 EST 2006


Author: chris
Date: 2006-02-02 13:47:34 -0500 (Thu, 02 Feb 2006)
New Revision: 13079
Trac: http://svn.gnucash.org/trac/changeset/13079

Modified:
   gnucash/trunk/Makefile.am
   gnucash/trunk/make-gnucash-potfiles.in
Log:
   Allow make-gnucash-potfiles to run from directories other than srcdir.
   Better documentation of exactly what m-g-potfiles excludes, and a general
   clean-up of the script.


Modified: gnucash/trunk/Makefile.am
===================================================================
--- gnucash/trunk/Makefile.am	2006-02-02 15:55:16 UTC (rev 13078)
+++ gnucash/trunk/Makefile.am	2006-02-02 18:47:34 UTC (rev 13079)
@@ -92,6 +92,7 @@
 make-gnucash-potfiles: make-gnucash-potfiles.in Makefile
 	rm -f $@.tmp
 	sed < $< > $@.tmp \
+            -e 's:@-SRCDIR-@:${srcdir}:g' \
             -e 's:@-PERL-@:${PERL}:g'
 	chmod +x $@.tmp
 	mv $@.tmp $@

Modified: gnucash/trunk/make-gnucash-potfiles.in
===================================================================
--- gnucash/trunk/make-gnucash-potfiles.in	2006-02-02 15:55:16 UTC (rev 13078)
+++ gnucash/trunk/make-gnucash-potfiles.in	2006-02-02 18:47:34 UTC (rev 13079)
@@ -2,86 +2,50 @@
 # -*- perl -*-
 #
 # This perl script is used to make po/POTFILES.in, the list
-# of C files to be searched for translatable strings.
+# of files to be searched for translatable strings.
 #
+# It will exclude any files listed in po/POTFILES.skip or that match the
+# regexp patterns listed in @ignorepatterns.
+#
 # Author: Dave Peticolas <dave at krondo.com>
 
 use strict;
-
 use File::Basename;
 
-my @possible_files = `find src -name '*.c' -o -name '*.glade'      \\
+# Note: These are perl regexp patterns, *not* normal shell wildcards!
+my @ignorepatterns = ('gw-', 'test', 'experimental');
+
+my @skipped_files = `grep -v \# @-SRCDIR-@/po/POTFILES.skip`;
+
+my @possible_files = `find @-SRCDIR-@/src -name '*.c' -o -name '*.glade' \\
                       -o -name '*.desktop.in' -o -name '*.keys.in' \\
                       -o -name '*.schemas.in' |sort`;
 ## For perl files add the following:
 # -o -name '*.pl'
 
-my @skipped_files = `grep -v \# po/POTFILES.skip`;
+print "# This is a list of files which contain translatable strings.\n";
+print "# This file was generated by ../make-gnucash-potfiles.\n";
 
-chomp(my $cwd = `pwd`);
-
-# Since we don't have any cvsignore files anymore, add patterns here
-# that will emulate the old behaviour. Note: These are perl regexp
-# patterns, *not* normal shell wildcards!
-my @ignorepatterns = ('gw-', 'test', 'experimental');
-
 my %ignores;
-
-## Unfortunately this won't work anymore since we don't have .cvsignore
-## files anymore.
-# my @cvsignores = `find src -name '.cvsignore'`;
-# foreach my $one_ignore (@cvsignores) {
-#   chomp($one_ignore);
-#   my ($name, $path) = fileparse($one_ignore);
-#   $path =~ s/^\.\///;
-#   open (IG, $one_ignore);
-#   chdir $path;
-#   foreach my $fl (<IG>) {
-#     chomp $fl;
-#     next unless $fl;
-#     my @matches = glob ($fl);
-#     foreach my $match (@matches) {
-#       chomp($match);
-#       next unless $match;
-#       $ignores{$path . $match} = 1;
-#     }
-#   }
-#   close (IG);
-#   chdir $cwd;
-# }
-
-print "# List of files which containing translatable strings.\n";
-print "# This file was generated by ../make-gnucash-potfiles.in.\n";
-print "\n";
-
 foreach my $file (@possible_files) {
-  chomp($file);
-  my ($name, $path) = fileparse($file);
-  $path =~ s/^\.\///;
+    chomp($file);
+    my ($name, $path) = fileparse($file);
+    $path =~ s/^\.\///;
 
-  foreach my $one_ignore (@ignorepatterns, @skipped_files) {
-    chomp($one_ignore);
-    next unless $one_ignore;
+    foreach my $pat (@ignorepatterns, @skipped_files) {
+        chomp($pat);
+        next unless $pat;
 
-    if ($file =~ m/$one_ignore/) {
-      $ignores{$path . $name} = 1;
+        if ($file =~ m/$pat/ || $name =~ m/$pat/ || $path =~ m/$pat/) {
+            $ignores{$path . $name} = 1;
+        }
     }
-
-    if ($name =~ m/$one_ignore/) {
-      $ignores{$path . $name} = 1;
-      #print "not $name\n";
-    }
-    if ($path =~ m/$one_ignore/) {
-      $ignores{$path . $name} = 1;
-      #print "not $name\n";
-    }
-  }
-  next if $ignores{$path . $name};
-
-  # Ignore unreadable files, e.g. dangling symlinks
-  next unless (-r $path . $name);
-
-  print $path . $name . "\n";
+    next if $ignores{$path . $name};
+    
+    # Ignore unreadable files, e.g. dangling symlinks
+    next unless (-r $path . $name);
+    
+    print $path . $name . "\n";
 }
 
 # These are also added, even though they are outside of src/



More information about the gnucash-changes mailing list