~ubuntu-branches/ubuntu/precise/contact-lookup-applet/precise

« back to all changes in this revision

Viewing changes to intltool-update.in

  • Committer: Bazaar Package Importer
  • Author(s): Ross Burton, Ross Burton, Loic Minier
  • Date: 2007-05-24 14:55:20 UTC
  • mfrom: (1.1.4 upstream) (2.1.2 lenny)
  • Revision ID: james.westby@ubuntu.com-20070524145520-mbzbi7ikhe3ep1ya
Tags: 0.16-1
[ Ross Burton ]
* New upstream release.

[ Loic Minier ]
* Add a get-orig-source target to retrieve the upstream tarball.

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.0";
 
33
my $VERSION = "0.35.5";
34
34
my $PACKAGE = "intltool";
35
35
 
36
36
## Loaded modules
90
90
$| = 1;
91
91
 
92
92
## Sometimes the source tree will be rooted somewhere else.
93
 
my $SRCDIR = ".";
 
93
my $SRCDIR = $ENV{"srcdir"} || ".";
94
94
my $POTFILES_in;
95
95
 
96
 
$SRCDIR = $ENV{"srcdir"} if $ENV{"srcdir"};
97
96
$POTFILES_in = "<$SRCDIR/POTFILES.in";
98
97
 
99
98
my $devnull = ($^O eq 'MSWin32' ? 'NUL:' : '/dev/null');
124
123
 
125
124
&Console_Write_IntltoolHelp if $arg_count > 1;
126
125
 
 
126
my $PKGNAME = FindPackageName ();
 
127
 
127
128
# --version and --help don't require a module name
128
 
my $MODULE = $GETTEXT_PACKAGE || &FindPackageName || "unknown";
 
129
my $MODULE = $GETTEXT_PACKAGE || $PKGNAME || "unknown";
129
130
 
130
131
if ($POT_ARG)
131
132
{
316
317
        @buf_potfiles_ignore,
317
318
        @buf_allfiles,
318
319
        @buf_allfiles_sorted,
319
 
        @buf_potfiles_sorted
 
320
        @buf_potfiles_sorted,
 
321
        @buf_potfiles_ignore_sorted
320
322
    );
321
323
 
322
324
    ## Search and find all translatable files
342
344
    ## comparing with POTFILES.in
343
345
    foreach my $ignore ("POTFILES.skip", "POTFILES.ignore")
344
346
    {
345
 
        (-s $ignore) or next;
 
347
        (-s "$SRCDIR/$ignore") or next;
346
348
 
347
349
        if ("$ignore" eq "POTFILES.ignore")
348
350
        {
351
353
        }
352
354
 
353
355
        print "Found $ignore: Ignoring files...\n" if $VERBOSE;
354
 
        open FILE, "<$ignore" or die "ERROR: Failed to open $ignore!\n";
 
356
        open FILE, "<$SRCDIR/$ignore" or die "ERROR: Failed to open $SRCDIR/$ignore!\n";
355
357
            
356
358
        while (<FILE>)
357
359
        {
359
361
        }
360
362
        close FILE;
361
363
 
362
 
        @buf_potfiles = (@buf_potfiles_ignore, @buf_potfiles);
 
364
        @buf_potfiles_ignore_sorted = sort (@buf_potfiles_ignore);
363
365
    }
364
366
 
365
367
    foreach my $file (@buf_i18n_plain)
417
419
                }
418
420
            }       
419
421
 
420
 
            if (/\.GetString ?\(QUOTEDTEXT/)
 
422
            if (/\w\.GetString *\(QUOTEDTEXT/)
421
423
            {
422
424
                if (defined isNotValidMissing (unpack("x3 A*", $file))) {
423
425
                    ## Remove the first 3 chars and add newline
426
428
                last;
427
429
            }
428
430
 
429
 
            if (/_\(QUOTEDTEXT/)
 
431
            ## N_ Q_ and _ are the three macros defined in gi8n.h
 
432
            if (/[NQ]?_ *\(QUOTEDTEXT/)
430
433
            {
431
434
                if (defined isNotValidMissing (unpack("x3 A*", $file))) {
432
435
                    ## Remove the first 3 chars and add newline
489
492
        $in2{$_} = 1;
490
493
    }
491
494
 
 
495
    foreach (@buf_potfiles_ignore_sorted) 
 
496
    {
 
497
        $in2{$_} = 1;
 
498
    }
 
499
 
492
500
    my @result;
493
501
 
494
502
    foreach (@buf_allfiles_sorted)
504
512
    foreach (@buf_potfiles_sorted)
505
513
    {
506
514
        chomp (my $dummy = $_);
507
 
        if ("$dummy" ne "" and ! -f "../$dummy")
 
515
        if ("$dummy" ne "" and !(-f "$SRCDIR/../$dummy" or -f "../$dummy"))
508
516
        {
509
517
            push @buf_potfiles_notexist, $_;
510
518
        }
537
545
            warn "\n" if ($VERBOSE or @result);
538
546
            warn "\e[1mThe following files do not exist anymore:\e[0m\n\n";
539
547
            warn @buf_potfiles_notexist, "\n";
540
 
            warn "Please remove them from POTFILES.in or POTFILES.skip. A file \e[1m'notexist'\e[0m\n".
 
548
            warn "Please remove them from POTFILES.in. A file \e[1m'notexist'\e[0m\n".
541
549
                 "containing this list of absent files has been written in the current directory.\n";
542
550
        }
543
551
    }
555
563
    exit 1;
556
564
}
557
565
 
 
566
sub isIntltoolExtractInPath
 
567
{
 
568
    my ($file) = @_;
 
569
    # 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));
 
571
    return 0;
 
572
}
 
573
 
558
574
sub GenerateHeaders
559
575
{
560
 
    my $EXTRACT = "@INTLTOOL_EXTRACT@";
561
 
    chomp $EXTRACT;
562
 
 
563
 
    $EXTRACT = $ENV{"INTLTOOL_EXTRACT"} if $ENV{"INTLTOOL_EXTRACT"};
 
576
    my $EXTRACT = $ENV{"INTLTOOL_EXTRACT"} || "intltool-extract";
564
577
 
565
578
    ## Generate the .h header files, so we can allow glade and
566
579
    ## xml translation support
567
 
    if (! -x "$EXTRACT")
 
580
    if (! isIntltoolExtractInPath("$EXTRACT"))
568
581
    {
569
582
        print STDERR "\n *** The intltool-extract script wasn't found!"
570
583
             ."\n *** Without it, intltool-update can not generate files.\n";
671
684
        } 
672
685
        else 
673
686
        {
674
 
            if ($SRCDIR eq ".") {
675
 
                print OUTFILE "../$_\n";
676
 
            } else {
677
 
                print OUTFILE "$SRCDIR/../$_\n";
678
 
            }
679
 
            $gettext_code = &TextFile_DetermineEncoding ("../$_") if ($gettext_support_nonascii and not defined $forced_gettext_code);
 
687
            print OUTFILE "$SRCDIR/../$_\n";
 
688
            $gettext_code = &TextFile_DetermineEncoding ("$SRCDIR/../$_") if ($gettext_support_nonascii and not defined $forced_gettext_code);
680
689
        }
681
690
 
682
691
        next if (! $gettext_support_nonascii);