Blame translation-canary/translation_canary/translated/__main__.py

Packit Service af52df
# Entry point for testing translations
Packit Service af52df
#
Packit Service af52df
# Copyright (C) 2015  Red Hat, Inc.
Packit Service af52df
#
Packit Service af52df
# This copyrighted material is made available to anyone wishing to use,
Packit Service af52df
# modify, copy, or redistribute it subject to the terms and conditions of
Packit Service af52df
# the GNU Lesser General Public License v.2, or (at your option) any later
Packit Service af52df
# version. This program is distributed in the hope that it will be useful,
Packit Service af52df
# but WITHOUT ANY WARRANTY expressed or implied, including the implied
Packit Service af52df
# warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
Packit Service af52df
# the GNU Lesser General Public License for more details.  You should have
Packit Service af52df
# received a copy of the GNU Lesser General Public License along with this
Packit Service af52df
# program; if not, write to the Free Software Foundation, Inc., 51 Franklin
Packit Service af52df
# Street, Fifth Floor, Boston, MA 02110-1301, USA.  Any Red Hat trademarks
Packit Service af52df
# that are incorporated in the source code or documentation are not subject
Packit Service af52df
# to the GNU Lesser General Public License and may only be used or
Packit Service af52df
# replicated with the express permission of Red Hat, Inc.
Packit Service af52df
#
Packit Service af52df
# Red Hat Author(s): David Shea <dshea@redhat.com>
Packit Service af52df
Packit Service af52df
import sys, argparse
Packit Service af52df
from . import testSourceTree
Packit Service af52df
Packit Service af52df
ap = argparse.ArgumentParser(description='Validate translated strings')
Packit Service af52df
ap.add_argument('--release', action='store_true', default=False,
Packit Service af52df
        help='Run in release mode')
Packit Service af52df
ap.add_argument('--test', dest='release', action='store_false',
Packit Service af52df
        help='Run in test mode')
Packit Service af52df
ap.add_argument('--no-modify-linguas', dest='modify_linguas', action='store_false', default=True,
Packit Service af52df
        help='In release mode, do not remove failing translation from LINGUAS')
Packit Service af52df
ap.add_argument('source_trees', metavar='SOURCE-TREE', nargs='+',
Packit Service af52df
        help='Source directory to test')
Packit Service af52df
Packit Service af52df
args = ap.parse_args()
Packit Service af52df
Packit Service af52df
status = 0
Packit Service af52df
for srcdir in args.source_trees:
Packit Service af52df
    if not testSourceTree(srcdir, args.release, args.modify_linguas):
Packit Service af52df
        status = 1
Packit Service af52df
Packit Service af52df
sys.exit(status)