diff options
author | Cristián Maureira-Fredes <Cristian.Maureira-Fredes@qt.io> | 2022-06-27 23:33:10 +0200 |
---|---|---|
committer | Cristián Maureira-Fredes <cristian.maureira-fredes@qt.io> | 2022-06-29 11:01:58 +0200 |
commit | 39b38b0cfc81d352c60c44efeb890b10c3e1bc88 (patch) | |
tree | a7777082b293a490f73fd49f72820b1dd3fda4a9 /build_scripts/options.py | |
parent | eba195611ac30fd490e87a03238060eca05f2073 (diff) |
build: fix readability details
Removing some leftover common anti-patterns:
- remove unnecessary dict() usage
- remove unnecessary map()
- avoid index-based loops
- use capitalize() instead of index-based capitalization
- use f-strings for concatenation
Pick-to: 6.2 6.3
Change-Id: I0ffdf73ec47c6ef537789015052dea0fd047350d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'build_scripts/options.py')
-rw-r--r-- | build_scripts/options.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/build_scripts/options.py b/build_scripts/options.py index 462c6417a..92e77aabc 100644 --- a/build_scripts/options.py +++ b/build_scripts/options.py @@ -81,9 +81,9 @@ class Options(object): :return: Either the option value or None. """ - option = '--' + name - short_option = '-' + short_option_name if short_option_name else None - single_option_prefix = option + '=' + option = f"--{name}" + short_option = f"-{short_option_name}" if short_option_name else None + single_option_prefix = f"{option}=" value = None for index in reversed(range(len(sys.argv))): arg = sys.argv[index] @@ -129,7 +129,7 @@ def _jobs_option_value(): """Option value for parallel builds.""" value = option_value('parallel', short_option_name='j') if value: - return '-j' + value if not value.startswith('-j') else value + return f"-j{value}" if not value.startswith('-j') else value return '' |