diff options
author | Patrik Teivonen <patrik.teivonen@qt.io> | 2022-08-29 10:01:04 +0300 |
---|---|---|
committer | Patrik Teivonen <patrik.teivonen@qt.io> | 2022-09-06 07:05:24 +0000 |
commit | b572d10a9d12bd2d983fdaf57de4ec3050e6d800 (patch) | |
tree | 9d27768240ef1caa252428c44676d089caee589b /packaging-tools/optionparser.py | |
parent | d4c144513ee9813bac5f8a2207516bb48b9035fe (diff) |
Reduce use of module globals by wrapping code outside functions in main
-Move code from module scope to main() functions where it makes sense
-Pass module variables as arguments to functions that used them
Linters will complain about naming clashes in outer scope if same name
is used in a function.
Change-Id: I1319cf1632f94907ee918e6f7593c79b0909e48b
Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
Diffstat (limited to 'packaging-tools/optionparser.py')
-rw-r--r-- | packaging-tools/optionparser.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/packaging-tools/optionparser.py b/packaging-tools/optionparser.py index 381cf8fc0..a03eb8864 100644 --- a/packaging-tools/optionparser.py +++ b/packaging-tools/optionparser.py @@ -81,7 +81,8 @@ def getPkgOptions(confFilePath): return PackagingOptions(confFilePath) -if __name__ == '__main__': +def main() -> None: + """Main""" parser = argparse.ArgumentParser(prog="Parse packaging related options from config file.") parser.add_argument("--conf-file", dest="conf_file", required=True, type=str, help="Absolute path pointing into configuration file which contains all required options for packaging.") @@ -90,3 +91,7 @@ if __name__ == '__main__': options = getPkgOptions(args.conf_file) configMap = options.configMap() print(configMap) + + +if __name__ == '__main__': + main() |