~ubuntu-branches/ubuntu/jaunty/transmission/jaunty-security

« back to all changes in this revision

Viewing changes to intltool-update.in

  • Committer: Bazaar Package Importer
  • Author(s): Philipp Benner
  • Date: 2007-11-22 12:37:14 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20071122123714-b0xi4zxhgk5qwbmc
Tags: 0.93.dfsg-2
* Added missing build-dependency (python).
* debian/control: switching to Homepage, Vcs-Browser and Vcs-Svn official
  fields (Leo "costela" Antunes)

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
 
31
31
## Release information
32
32
my $PROGRAM = "intltool-update";
33
 
my $VERSION = "0.35.5";
 
33
my $VERSION = "0.36.2";
34
34
my $PACKAGE = "intltool";
35
35
 
36
36
## Loaded modules
71
71
"sheet(?:\\.in)+|".     # ?
72
72
"schemas(?:\\.in)+|".   # GConf specific
73
73
"pong(?:\\.in)+|".      # DEPRECATED: PONG is not used [by GNOME] any longer.
74
 
"kbd(?:\\.in)+";        # GOK specific. 
 
74
"kbd(?:\\.in)+|".       # GOK specific. 
 
75
"policy(?:\\.in)+";     # PolicyKit files
75
76
 
76
77
my $ini_support =
77
78
"icon(?:\\.in)+|".      # http://www.freedesktop.org/Standards/icon-theme-spec
328
329
        push @buf_i18n_ini,          "$File::Find::name" if /\.($ini_support)$/;
329
330
        push @buf_i18n_xml_unmarked, "$File::Find::name" if /\.(schemas(\.in)+)$/;
330
331
        }, "..";
331
 
 
 
332
    find sub { 
 
333
        push @buf_i18n_plain,        "$File::Find::name" if /\.($buildin_gettext_support)$/;
 
334
        push @buf_i18n_xml,          "$File::Find::name" if /\.($xml_support)$/;
 
335
        push @buf_i18n_ini,          "$File::Find::name" if /\.($ini_support)$/;
 
336
        push @buf_i18n_xml_unmarked, "$File::Find::name" if /\.(schemas(\.in)+)$/;
 
337
        }, "$SRCDIR/..";
332
338
 
333
339
    open POTFILES, $POTFILES_in or die "$PROGRAM:  there's no POTFILES.in!\n";
334
340
    @buf_potfiles = grep !/^(#|\s*$)/, <POTFILES>;
489
495
    my %in2;
490
496
    foreach (@buf_potfiles_sorted) 
491
497
    {
 
498
        s#^$SRCDIR/../##;
 
499
        s#^$SRCDIR/##;
492
500
        $in2{$_} = 1;
493
501
    }
494
502
 
495
503
    foreach (@buf_potfiles_ignore_sorted) 
496
504
    {
 
505
        s#^$SRCDIR/../##;
 
506
        s#^$SRCDIR/##;
497
507
        $in2{$_} = 1;
498
508
    }
499
509
 
501
511
 
502
512
    foreach (@buf_allfiles_sorted)
503
513
    {
504
 
        if (!exists($in2{$_}))
 
514
        my $dummy = $_;
 
515
        my $srcdir = $SRCDIR;
 
516
 
 
517
        $srcdir =~ s#^../##;
 
518
        $dummy =~ s#^$srcdir/../##;
 
519
        $dummy =~ s#^$srcdir/##;
 
520
        $dummy =~ s#_build/##;
 
521
        if (!exists($in2{$dummy}))
505
522
        {
506
 
            push @result, $_
 
523
            push @result, $dummy
507
524
        }
508
525
    }
509
526
 
563
580
    exit 1;
564
581
}
565
582
 
566
 
sub isIntltoolExtractInPath
 
583
sub isProgramInPath
567
584
{
568
585
    my ($file) = @_;
569
586
    # If either a file exists, or when run it returns 0 exit status
570
 
    return 1 if ((-x $file) or (system("$file >/dev/null") == 0));
 
587
    return 1 if ((-x $file) or (system("$file --version >$devnull") == 0));
 
588
    return 0;
 
589
}
 
590
 
 
591
sub isGNUGettextTool
 
592
{
 
593
    my ($file) = @_;
 
594
    # Check that we are using GNU gettext tools
 
595
    if (isProgramInPath ($file))
 
596
    {
 
597
        my $version = `$file --version`;
 
598
        return 1 if ($version =~ m/.*\(GNU .*\).*/);
 
599
    }
571
600
    return 0;
572
601
}
573
602
 
577
606
 
578
607
    ## Generate the .h header files, so we can allow glade and
579
608
    ## xml translation support
580
 
    if (! isIntltoolExtractInPath("$EXTRACT"))
 
609
    if (! isProgramInPath ("$EXTRACT"))
581
610
    {
582
611
        print STDERR "\n *** The intltool-extract script wasn't found!"
583
612
             ."\n *** Without it, intltool-update can not generate files.\n";
624
653
#
625
654
sub GeneratePOTemplate
626
655
{
627
 
    my $XGETTEXT = $ENV{"XGETTEXT"} || "@INTLTOOL_XGETTEXT@";
 
656
    my $XGETTEXT = $ENV{"XGETTEXT"} || "xgettext";
628
657
    my $XGETTEXT_ARGS = $ENV{"XGETTEXT_ARGS"} || '';
629
658
    chomp $XGETTEXT;
630
659
 
631
 
    if (! -x $XGETTEXT)
 
660
    if (! isGNUGettextTool ("$XGETTEXT"))
632
661
    {
633
 
        print STDERR " *** xgettext is not found on this system!\n".
 
662
        print STDERR " *** GNU xgettext is not found on this system!\n".
634
663
                     " *** Without it, intltool-update can not extract strings.\n";
635
664
        exit;
636
665
    }
726
755
    unlink "$MODULE.pot";
727
756
    my @xgettext_argument=("$XGETTEXT",
728
757
                           "--add-comments",
729
 
                           "--directory\=\.",
 
758
                           "--directory\=.",
 
759
                           "--default-domain\=$MODULE",
 
760
                           "--flag\=g_strdup_printf:1:c-format",
 
761
                           "--flag\=g_string_printf:2:c-format",
 
762
                           "--flag\=g_string_append_printf:2:c-format",
 
763
                           "--flag\=g_error_new:3:c-format",
 
764
                           "--flag\=g_set_error:4:c-format",
 
765
                           "--flag\=g_markup_printf_escaped:1:c-format",
 
766
                           "--flag\=g_log:3:c-format",
 
767
                           "--flag\=g_print:1:c-format",
 
768
                           "--flag\=g_printerr:1:c-format",
 
769
                           "--flag\=g_printf:1:c-format",
 
770
                           "--flag\=g_fprintf:2:c-format",
 
771
                           "--flag\=g_sprintf:2:c-format",
 
772
                           "--flag\=g_snprintf:3:c-format",
 
773
                           "--flag\=g_scanner_error:2:c-format",
 
774
                           "--flag\=g_scanner_warn:2:c-format",
730
775
                           "--output\=$MODULE\.pot",
731
776
                           "--files-from\=\.\/POTFILES\.in\.temp");
732
777
    my $XGETTEXT_KEYWORDS = &FindPOTKeywords;
793
838
{
794
839
    -f "$MODULE.pot" or die "$PROGRAM: $MODULE.pot does not exist.\n";
795
840
 
796
 
    my $MSGMERGE = $ENV{"MSGMERGE"} || "@INTLTOOL_MSGMERGE@";
 
841
    my $MSGMERGE = $ENV{"MSGMERGE"} || "msgmerge";
797
842
    my ($lang, $outfile) = @_;
798
843
 
 
844
    if (! isGNUGettextTool ("$MSGMERGE"))
 
845
    {
 
846
        print STDERR " *** GNU msgmerge is not found on this system!\n".
 
847
                     " *** Without it, intltool-update can not extract strings.\n";
 
848
        exit;
 
849
    }
 
850
 
799
851
    print "Merging $SRCDIR/$lang.po with $MODULE.pot..." if $VERBOSE;
800
852
 
801
853
    my $infile = "$SRCDIR/$lang.po";
836
888
sub Console_Write_TranslationStatus
837
889
{
838
890
    my ($lang, $output_file) = @_;
839
 
    my $MSGFMT = $ENV{"MSGFMT"} || "@INTLTOOL_MSGFMT@";
 
891
    my $MSGFMT = $ENV{"MSGFMT"} || "msgfmt";
 
892
 
 
893
    if (! isGNUGettextTool ("$MSGFMT"))
 
894
    {
 
895
        print STDERR " *** GNU msgfmt is not found on this system!\n".
 
896
                     " *** Without it, intltool-update can not extract strings.\n";
 
897
        exit;
 
898
    }
840
899
 
841
900
    $output_file = "$SRCDIR/$lang.po" if ($output_file eq "");
842
901
 
845
904
 
846
905
sub Console_Write_CoverageReport
847
906
{
848
 
    my $MSGFMT = $ENV{"MSGFMT"} || "@INTLTOOL_MSGFMT@";
 
907
    my $MSGFMT = $ENV{"MSGFMT"} || "msgfmt";
 
908
 
 
909
    if (! isGNUGettextTool ("$MSGFMT"))
 
910
    {
 
911
        print STDERR " *** GNU msgfmt is not found on this system!\n".
 
912
                     " *** Without it, intltool-update can not extract strings.\n";
 
913
        exit;
 
914
    }
849
915
 
850
916
    &GatherPOFiles;
851
917
 
852
918
    foreach my $lang (@languages) 
853
919
    {
854
 
        print "$lang: ";
 
920
        print STDERR "$lang: ";
855
921
        &POFile_Update ($lang, "");
856
922
    }
857
923
 
858
 
    print "\n\n * Current translation support in $MODULE \n\n";
 
924
    print STDERR "\n\n * Current translation support in $MODULE \n\n";
859
925
 
860
926
    foreach my $lang (@languages)
861
927
    {
862
 
        print "$lang: ";
 
928
        print STDERR "$lang: ";
863
929
        system ("$MSGFMT", "-o", "$devnull", "--verbose", "$SRCDIR/$lang.po");
864
930
    }
865
931
}
933
999
 
934
1000
            $conf_in || die "Cannot find top_builddir in Makevars.";
935
1001
        }
936
 
        elsif (-f "../configure.ac") 
 
1002
        elsif (-f "$SRCDIR/../configure.ac") 
937
1003
        {
938
 
            $conf_in = "../configure.ac";
 
1004
            $conf_in = "$SRCDIR/../configure.ac";
939
1005
        } 
940
 
        elsif (-f "../configure.in") 
 
1006
        elsif (-f "$SRCDIR/../configure.in") 
941
1007
        {
942
 
            $conf_in = "../configure.in";
 
1008
            $conf_in = "$SRCDIR/../configure.in";
943
1009
        } 
944
1010
        else 
945
1011
        {