Commit 4cdd7b97 authored by Stefan Behnel's avatar Stefan Behnel

Allow explicit "-2" option for the cythonize script to set the language level...

Allow explicit "-2" option for the cythonize script to set the language level to 2 (the current, but not future, default).
parent 82279c17
...@@ -161,7 +161,9 @@ def parse_args(args): ...@@ -161,7 +161,9 @@ def parse_args(args):
dest='options', default={}, type="str", dest='options', default={}, type="str",
action='callback', callback=parse_options, action='callback', callback=parse_options,
help='set a cythonize option') 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') help='use Python 3 syntax mode by default')
parser.add_option('-a', '--annotate', dest='annotate', action='store_true', parser.add_option('-a', '--annotate', dest='annotate', action='store_true',
help='generate annotated HTML page for source files') help='generate annotated HTML page for source files')
...@@ -195,8 +197,9 @@ def parse_args(args): ...@@ -195,8 +197,9 @@ def parse_args(args):
options.build = True options.build = True
if multiprocessing is None: if multiprocessing is None:
options.parallel = 0 options.parallel = 0
if options.python3_mode: if options.language_level:
options.options['language_level'] = 3 assert options.language_level in (2, 3)
options.options['language_level'] = options.language_level
return options, args return options, args
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment