~midori/midori/trunk

« back to all changes in this revision

Viewing changes to wscript

  • Committer: Christian Dywan
  • Date: 2013-06-01 19:58:42 UTC
  • mto: This revision was merged to the branch mainline in revision 6189.
  • Revision ID: christian.dywan@canonical.com-20130601195842-v5tjei0obqeqzqsg
Separate ./waf --update-pot and ./waf --update-po from the build

Show diffs side-by-side

added added

removed removed

Lines of Context:
411
411
 
412
412
    group = opt.add_option_group ('Localization and documentation', '')
413
413
    add_enable_option ('nls', 'native language support', group)
 
414
    group.add_option ('--update-pot', action='store_true', default=False,
 
415
        help='Update gettext template', dest='update_pot')
414
416
    group.add_option ('--update-po', action='store_true', default=False,
415
 
        help='Update localization files', dest='update_po')
 
417
        help='Update all localization files', dest='update_po')
416
418
    add_enable_option ('docs', 'informational text files', group)
417
419
    add_enable_option ('apidocs', 'API documentation', group, disable=True)
418
420
 
453
455
write_linguas_file = feature ('intltool_po')(write_linguas_file)
454
456
 
455
457
def build (bld):
 
458
    if Options.options.update_pot:
 
459
        os.chdir ('./po')
 
460
        try:
 
461
            subprocess.call(['intltool-update', '-p', '-g', APPNAME])
 
462
            Utils.pprint ('YELLOW', "Updated gettext template.")
 
463
        except:
 
464
            Utils.pprint ('RED', "Failed to update gettext template.")
 
465
            Utils.pprint ('RED', "Make sure intltool is installed.")
 
466
        os.chdir ('..')
 
467
        return
 
468
 
 
469
    if Options.options.update_po:
 
470
        os.chdir('./po')
 
471
        try:
 
472
            subprocess.call(['intltool-update', '-r', '-g', APPNAME])
 
473
            Utils.pprint ('YELLOW', "Updated translations.")
 
474
        except:
 
475
            Utils.pprint ('RED', "Failed to update translations.")
 
476
            Utils.pprint ('RED', "Make sure intltool is installed.")
 
477
        os.chdir ('..')
 
478
        return
 
479
 
456
480
    bld.add_group ()
457
481
 
458
482
    bld.add_subdirs ('midori icons')
473
497
        obj = bld.new_task_gen ('intltool_po')
474
498
        obj.podir = 'po'
475
499
        obj.appname = APPNAME
476
 
        os.chdir ('./po')
477
 
        subprocess.call(['intltool-update', '-p', '-g', APPNAME])
478
 
        os.chdir ('..')
479
500
 
480
501
    if bld.env['GTKDOC_SCAN'] and Options.commands['build']:
481
502
        bld.add_subdirs ('docs/api')
550
571
def distclean ():
551
572
    if os.path.exists ('po/LINGUAS'):
552
573
        os.remove ('po/LINGUAS')
553
 
    if os.path.exists ('po/midori.pot'):
554
 
        os.remove ('po/midori.pot')
555
574
 
556
575
def shutdown ():
557
576
    if Options.commands['install'] or Options.commands['uninstall']:
693
712
        # if test.num_tests_failed > 0 or test.num_tests_err > 0:
694
713
        #     sys.exit (1)
695
714
 
696
 
    elif Options.options.update_po:
697
 
        os.chdir('./po')
698
 
        try:
699
 
            subprocess.call(['intltool-update', '-r', '-g', APPNAME])
700
 
            Utils.pprint ('YELLOW', "Updated translations.")
701
 
        except:
702
 
            Utils.pprint ('RED', "Failed to update translations.")
703
 
            Utils.pprint ('RED', "Make sure intltool is installed.")
704
 
        os.chdir ('..')