diff options
author | Lukas <lukasmolleman@gmail.com> | 2022-04-20 19:54:39 +0200 |
---|---|---|
committer | Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> | 2022-06-22 14:07:19 +0200 |
commit | 157298bb808a943616991927f9370a86c1f2ca48 (patch) | |
tree | a0ea376a0ce971e917df43af8e6e676038797c1c /bin/update/create_full_mar.py | |
parent | 4e9b23cb2356cf7019a6ed81e08abf1664a72051 (diff) |
android and bin/update: make pythonic
Change-Id: Iaf791bfa8d9822843b26f2a2f2c3d94c55a60a0b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133358
Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com>
Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Diffstat (limited to 'bin/update/create_full_mar.py')
-rwxr-xr-x | bin/update/create_full_mar.py | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/bin/update/create_full_mar.py b/bin/update/create_full_mar.py index 48686be21e45..39cb23f1f20e 100755 --- a/bin/update/create_full_mar.py +++ b/bin/update/create_full_mar.py @@ -4,6 +4,7 @@ import sys import os import subprocess import json +import argparse from tools import uncompress_file_to_dir, get_file_info, make_complete_mar_name from config import parse_config @@ -12,15 +13,19 @@ from path import UpdaterPath, convert_to_unix, convert_to_native current_dir_path = os.path.dirname(os.path.realpath(convert_to_unix(__file__))) -def main(): - if len(sys.argv) < 5: - print("Usage: create_full_mar_for_languages.py $PRODUCTNAME $WORKDIR $FILENAMEPREFIX $UPDATE_CONFIG") - sys.exit(1) - update_config = sys.argv[4] - filename_prefix = sys.argv[3] - workdir = sys.argv[2] - product_name = sys.argv[1] +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('product_name') + parser.add_argument('workdir') + parser.add_argument('filename_prefix') + parser.add_argument('update_config') + args = parser.parse_args() + + update_config = args.update_config + filename_prefix = args.filename_prefix + workdir = args.workdir + product_name = args.update_config if len(update_config) == 0: print("missing update config") @@ -45,10 +50,11 @@ def main(): sign_mar_file(target_dir, config, mar_file, filename_prefix) - file_info = { 'complete' : get_file_info(mar_file, config.base_url) } + file_info = {'complete': get_file_info(mar_file, config.base_url)} with open(os.path.join(target_dir, 'complete_info.json'), "w") as complete_info_file: - json.dump(file_info, complete_info_file, indent = 4) + json.dump(file_info, complete_info_file, indent=4) + if __name__ == '__main__': main() |