def main(): args = get_args() rules = args.rule or [('*.pot', '{locale}/LC_MESSAGES/{filename}.po')] try: zc = IniConfig(os.path.expanduser('~/.config/zanata.ini')) ProjectConfig(zc, args.file, rules, project=args.project, version=args.version, srcdir=args.srcdir, txdir=args.txdir) except ValueError as e: sys.exit(e)
def main(): args = get_args() zc = IniConfig(os.path.expanduser('~/.config/zanata.ini')) rest_service = ZanataRestService(zc, content_type='application/json', verify=args.verify) try: r = rest_service.query('/rest/projects/p/%s/iterations/i/%s' % (args.project, args.version)) except ValueError: sys.exit(1) if r.status_code == 200: details = json.loads(r.content) if details['status'] == 'READONLY': sys.exit(1) sys.exit(0)
def main(): args = get_args() default_rule = ('**/*.pot', '{locale_with_underscore}/LC_MESSAGES/{filename}.po') rules = args.rule or [default_rule] try: zc = IniConfig(os.path.expanduser('~/.config/zanata.ini')) ProjectConfig(zc, args.file, rules, args.verify, project=args.project, version=args.version, srcdir=args.srcdir, txdir=args.txdir, excludes=args.excludes) except ValueError as e: sys.exit(e)
def main(): # Loads zanata.ini configuration file try: zc = IniConfig(os.path.expanduser('~/.config/zanata.ini')) except ValueError as e: sys.exit(e) # Parses command option(s) parser = argparse.ArgumentParser(description='Generate a csv file which ' 'contains the list of translators for ' 'a specified target role with name and ' 'e-mail address. Require a privilege ' 'to access Zanata accounts API.') parser.add_argument("-o", "--output-file", help=("Specify the output file. " "Default: zanata_userinfo_output.csv.")) parser.add_argument("-r", "--role", help=("Specify the target role. " "Roles: coordinators, translators, reviewers." "Default: translators.")) parser.add_argument("-l", "--lang", type=_comma_separated_list, help=("Specify language(s). Comma-separated list. " "Language code like zh-CN, ja needs to be used. " "Otherwise all languages are processed.")) parser.add_argument('--no-verify', action='store_false', dest='verify', help='Do not perform HTTPS certificate verification') parser.add_argument("user_yaml", help="YAML file of the user list") options = parser.parse_args() # Reads language team information language_teams = read_language_team_yaml(options.user_yaml, options.lang) users = get_zanata_userdata(zc, options.verify, options.role, language_teams) output_file = (options.output_file or 'zanata_userinfo_output.csv') write_userdata_to_file(users, output_file)