summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2018-08-25 10:46:36 +0200
committerStefan Behnel <stefan_ml@behnel.de>2018-08-25 10:46:36 +0200
commit4cdd7b97c295705192f6374d0e2cffdea6f1d265 (patch)
tree949edcc604fee751b977dc427638bfd7ceea3db4
parent82279c17ba0d84991f2c3a7ea78fad059731f7e8 (diff)
downloadcython-4cdd7b97c295705192f6374d0e2cffdea6f1d265.tar.gz
Allow explicit "-2" option for the cythonize script to set the language level to 2 (the current, but not future, default).
-rw-r--r--Cython/Build/Cythonize.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/Cython/Build/Cythonize.py b/Cython/Build/Cythonize.py
index c40a8d0de..339098d77 100644
--- a/Cython/Build/Cythonize.py
+++ b/Cython/Build/Cythonize.py
@@ -161,7 +161,9 @@ def parse_args(args):
dest='options', default={}, type="str",
action='callback', callback=parse_options,
help='set a cythonize option')
- parser.add_option('-3', dest='python3_mode', action='store_true',
+ parser.add_option('-2', dest='language_level', action='store_const', const=2, default=None,
+ help='use Python 2 syntax mode by default')
+ parser.add_option('-3', dest='language_level', action='store_const', const=3,
help='use Python 3 syntax mode by default')
parser.add_option('-a', '--annotate', dest='annotate', action='store_true',
help='generate annotated HTML page for source files')
@@ -195,8 +197,9 @@ def parse_args(args):
options.build = True
if multiprocessing is None:
options.parallel = 0
- if options.python3_mode:
- options.options['language_level'] = 3
+ if options.language_level:
+ assert options.language_level in (2, 3)
+ options.options['language_level'] = options.language_level
return options, args