aboutsummaryrefslogtreecommitdiffstats
path: root/build_scripts/options.py
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-10-26 16:29:59 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-10-30 18:38:58 +0000
commit9ec0fab3d67d7c5ecc3cb8d45d3ee8abc38aa8e0 (patch)
treea023ee43c3d9216db9da04f924924b7ff0589cad /build_scripts/options.py
parent329619e86070cf3af19be2bf4ca242eb8eeb8d70 (diff)
setup.py: Deprecate option --jobs
Check for the standard (build command) options --parallel/-j and deprecate --jobs. Fixes: PYSIDE-809 Change-Id: Ice5eaa787f84f093db6e7b3d2168332d5dfbab1f Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'build_scripts/options.py')
-rw-r--r--build_scripts/options.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/build_scripts/options.py b/build_scripts/options.py
index 3e3a63ca9..2d47bcca5 100644
--- a/build_scripts/options.py
+++ b/build_scripts/options.py
@@ -47,6 +47,12 @@ def _warn_multiple_option(option):
w = 'Option "{}" occurs multiple times on the command line.'.format(option)
warnings.warn(w)
+def _warn_deprecated_option(option, replacement=None):
+ w = 'Option "{}" is deprecated and may be removed in a future release.'.format(option)
+ if replacement:
+ w = '{}\nUse "{}" instead.'.format(w, replacement)
+ warnings.warn(w)
+
class Options(object):
def __init__(self):
@@ -64,7 +70,7 @@ class Options(object):
_warn_multiple_option(option)
return count > 0
- def option_value(self, name, remove=True):
+ def option_value(self, name, short_option_name=None, remove=True):
"""
Returns the value of a command line option or environment
variable.
@@ -79,11 +85,12 @@ 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 + '='
value = None
for index in reversed(range(len(sys.argv))):
arg = sys.argv[index]
- if arg == option:
+ if arg == option or short_option and arg == short_option:
if value:
_warn_multiple_option(option)
else:
@@ -140,7 +147,11 @@ OPTION_SKIP_DOCS = has_option("skip-docs")
# don't include pyside2-examples
OPTION_NOEXAMPLES = has_option("no-examples")
# number of parallel build jobs
-OPTION_JOBS = option_value('jobs')
+OPTION_JOBS = option_value('parallel', short_option_name='j')
+_deprecated_option_jobs = option_value('jobs')
+if _deprecated_option_jobs:
+ _warn_deprecated_option('jobs', 'parallel')
+ OPTION_JOBS = _deprecated_option_jobs
# Legacy, not used any more.
OPTION_JOM = has_option('jom')
# Do not use jom instead of nmake with msvc