diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-11-29 11:17:46 +0100 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-11-29 11:17:48 +0100 |
| commit | f72b75d9a75a32d93a66147ffaa240ea061bf0cd (patch) | |
| tree | 38b686f7063e0f08864f5cfb2192ec02bc059a02 /build_scripts/options.py | |
| parent | 5a74c902555ed6bce4b45889adfdaa1123b64ace (diff) | |
| parent | 26404dd4b6c61083bf5de1c1c2208bf2350aba0e (diff) | |
Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: Ie902334068eda21ed71934da56de168a9627e41d
Diffstat (limited to 'build_scripts/options.py')
| -rw-r--r-- | build_scripts/options.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/build_scripts/options.py b/build_scripts/options.py index c17f6a100..0e38566d5 100644 --- a/build_scripts/options.py +++ b/build_scripts/options.py @@ -44,8 +44,8 @@ import warnings def _warn_multiple_option(option): - w = 'Option "{}" occurs multiple times on the command line.'.format(option) - warnings.warn(w) + warnings.warn('Option "{}" occurs multiple times on the command line.'.format(option)) + def _warn_deprecated_option(option, replacement=None): w = 'Option "{}" is deprecated and may be removed in a future release.'.format(option) @@ -53,6 +53,7 @@ def _warn_deprecated_option(option, replacement=None): w = '{}\nUse "{}" instead.'.format(w, replacement) warnings.warn(w) + class Options(object): def __init__(self): @@ -62,13 +63,13 @@ class Options(object): def has_option(self, name, remove=True): """ Returns True if argument '--name' was passed on the command line. """ - option = '--' + name + option = '--{}'.format(name) count = sys.argv.count(option) remove_count = count if not remove and count > 0: remove_count -= 1 for i in range(remove_count): - sys.argv.remove(option) + sys.argv.remove(option) if count > 1: _warn_multiple_option(option) return count > 0 @@ -127,8 +128,8 @@ def has_option(*args, **kwargs): return options.has_option(*args, **kwargs) -def option_value(*args,**kwargs): - return options.option_value(*args,**kwargs) +def option_value(*args, **kwargs): + return options.option_value(*args, **kwargs) # Declare options |
