mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Tweak cmake/autotools so they produce the same output for POTFILES.in
This commit is contained in:
parent
96642c608f
commit
16b98cc5a4
@ -33,23 +33,15 @@ close IN;
|
||||
# * case-insensitive
|
||||
# * ignoring punctuation (-,_,.)
|
||||
#
|
||||
sub sort_func
|
||||
{
|
||||
my $stripped_a = $a;
|
||||
my $stripped_b = $b;
|
||||
$stripped_a =~ s/[-_.]//g;
|
||||
$stripped_b =~ s/[-_.]//g;
|
||||
# This sort function has been extracted into a separate file (util/elegant-sort.pl)
|
||||
# in order to use the same algorithm in both cmake and autools based builds
|
||||
|
||||
lc ($stripped_a) cmp lc ($stripped_b)
|
||||
||
|
||||
lc ($a) cmp lc ($b)
|
||||
}
|
||||
|
||||
my @possible_files = sort sort_func
|
||||
`cd @-SRCDIR-@ && find src lib -name '*.c' \\
|
||||
my @possible_files = `cd @-SRCDIR-@ && \\
|
||||
find src lib -name '*.c' \\
|
||||
-o -name '*.cpp' -o -name '*.glade' \\
|
||||
-o -name '*.desktop.in' -o -name '*.keys.in' \\
|
||||
-o -name '*.gschema.xml.in.in' -o -name '*.scm'`;
|
||||
-o -name '*.gschema.xml.in.in' -o -name '*.scm' \\
|
||||
| util/elegant-sort.pl`;
|
||||
## For perl files add the following:
|
||||
# -o -name '*.pl'
|
||||
|
||||
@ -71,7 +63,7 @@ foreach my $file (@possible_files) {
|
||||
}
|
||||
}
|
||||
next if $ignores{$path . $name};
|
||||
|
||||
|
||||
# Ignore unreadable files, e.g. dangling symlinks
|
||||
next unless (-r "@-SRCDIR-@/" . $path . $name);
|
||||
|
||||
@ -80,7 +72,7 @@ foreach my $file (@possible_files) {
|
||||
if ($file =~ m/.gschema.xml.in.in/ ){
|
||||
$type = "[type: gettext/gsettings]";
|
||||
}
|
||||
|
||||
|
||||
print $type . $path . $name . "\n";
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ ENDFUNCTION()
|
||||
|
||||
FUNCTION(MAKE_GNUCASH_POTFILES)
|
||||
|
||||
SET(IGNORE_PATTERNS "gw-" "test" "experimental" "python-bindings" "swig-.*\\.c")
|
||||
SET(IGNORE_PATTERNS "gw-" "test" "experimental" "python-bindings" "swig-.*\\.c" "^src/gnc/" "^src/optional/gtkmm")
|
||||
|
||||
# Create a list of candidate translation files
|
||||
FILE(GLOB_RECURSE FILES_IN RELATIVE ${CMAKE_SOURCE_DIR}
|
||||
@ -76,7 +76,7 @@ FUNCTION(MAKE_GNUCASH_POTFILES)
|
||||
# Only consider files in the src/ directory. Also check against list of ignore patterns
|
||||
SET(FILES "")
|
||||
FOREACH(path ${FILES_IN})
|
||||
STRING(REGEX MATCH "^src" IS_SRC ${path})
|
||||
STRING(REGEX MATCH "^(src/|lib)" IS_SRC ${path})
|
||||
IF (IS_SRC)
|
||||
SET(IS_IGNORED FALSE)
|
||||
FOREACH(pattern ${IGNORE_PATTERNS})
|
||||
@ -107,7 +107,7 @@ FUNCTION(MAKE_GNUCASH_POTFILES)
|
||||
STRING(REPLACE ";" "\n" SORT_IN "${FILES}")
|
||||
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/POTFILES.in.in "${SORT_IN}")
|
||||
|
||||
EXECUTE_PROCESS(COMMAND "sort"
|
||||
EXECUTE_PROCESS(COMMAND "${PERL_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/util/elegant-sort.pl"
|
||||
INPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/POTFILES.in.in
|
||||
OUTPUT_VARIABLE POTFILES_IN
|
||||
)
|
||||
@ -116,7 +116,7 @@ FUNCTION(MAKE_GNUCASH_POTFILES)
|
||||
# Write out the final list.
|
||||
# intltool-update insists that this file be in the source directory. :-(
|
||||
SET(POTFILES_IN_PATH ${CMAKE_CURRENT_SOURCE_DIR}/POTFILES.in)
|
||||
FILE(WRITE ${POTFILES_IN_PATH} "# This is a list of files which contain tranlatable strings.
|
||||
FILE(WRITE ${POTFILES_IN_PATH} "# This is a list of files which contain translatable strings.
|
||||
# This file was generated by ../make-gnucash-potfiles.
|
||||
")
|
||||
|
||||
@ -134,8 +134,6 @@ FUNCTION(MAKE_GNUCASH_POTFILES)
|
||||
src/gnome/gnucash.desktop.in.in
|
||||
src/libqof/qof/qofbookslots.h
|
||||
doc/tip_of_the_day.list.in
|
||||
lib/goffice/go-charmap-sel.c
|
||||
lib/goffice/go-optionmenu.c
|
||||
")
|
||||
|
||||
ENDFUNCTION()
|
||||
@ -203,4 +201,4 @@ ADD_CUSTOM_TARGET(check-po
|
||||
-D PO_DIR=${CMAKE_CURRENT_SOURCE_DIR}
|
||||
-P check-po.cmake
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
)
|
||||
|
@ -2,6 +2,7 @@
|
||||
# not distributed.
|
||||
src/backend/dbi/gncmod-backend-dbi.c
|
||||
src/backend/xml/gncmod-backend-xml.c
|
||||
src/backend/xml/gncmod-backend-xml.cpp
|
||||
src/gnome-utils/gnc-tree-model-selection.c
|
||||
|
||||
# These we don't want to translate because they're experimental:
|
||||
|
@ -1,2 +1,2 @@
|
||||
|
||||
SET_DIST_LIST(util_DIST gnc-vcs-info guile.c CMakeLists.txt)
|
||||
SET_DIST_LIST(util_DIST elegant-sort.pl gnc-vcs-info guile.c CMakeLists.txt)
|
||||
|
27
util/elegant-sort.pl
Executable file
27
util/elegant-sort.pl
Executable file
@ -0,0 +1,27 @@
|
||||
#!/usr/bin/perl -w
|
||||
# -*- perl -*-
|
||||
#
|
||||
# Sort filenames in POTFILES.in in a consistent way
|
||||
# This reduces the amount of clutter in our version manangement system
|
||||
# The files will be sorted
|
||||
# * per directory
|
||||
# * case-insensitive
|
||||
# * ignoring punctuation (-,_,.)
|
||||
#
|
||||
sub sort_func
|
||||
{
|
||||
my $stripped_a = $a;
|
||||
my $stripped_b = $b;
|
||||
$stripped_a =~ s/[-_.]//g;
|
||||
$stripped_b =~ s/[-_.]//g;
|
||||
|
||||
lc ($stripped_a) cmp lc ($stripped_b)
|
||||
||
|
||||
lc ($a) cmp lc ($b)
|
||||
}
|
||||
|
||||
#open my $fh, '<', $ARGV[0];
|
||||
#my @raw_files = <$fh>;
|
||||
my @raw_files = <STDIN>;
|
||||
my @possible_files = sort sort_func @raw_files;
|
||||
print @possible_files;
|
Loading…
Reference in New Issue
Block a user