Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
f019888c
Commit
f019888c
authored
Aug 04, 2019
by
realead
Committed by
Stefan Behnel
Aug 04, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace custom command line parser with argparse (GH-3001)
parent
78e417e5
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
594 additions
and
233 deletions
+594
-233
Cython/Build/Cythonize.py
Cython/Build/Cythonize.py
+2
-27
Cython/Compiler/CmdLine.py
Cython/Compiler/CmdLine.py
+205
-205
Cython/Compiler/Tests/TestCmdLine.py
Cython/Compiler/Tests/TestCmdLine.py
+387
-1
No files found.
Cython/Build/Cythonize.py
View file @
f019888c
...
@@ -120,33 +120,8 @@ def run_distutils(args):
...
@@ -120,33 +120,8 @@ def run_distutils(args):
def
create_args_parser
():
def
create_args_parser
():
from
argparse
import
ArgumentParser
,
Action
from
argparse
import
ArgumentParser
from
..Compiler.CmdLine
import
ParseDirectivesAction
,
ParseOptionsAction
,
ParseCompileTimeEnvAction
class
ParseDirectivesAction
(
Action
):
def
__call__
(
self
,
parser
,
namespace
,
values
,
option_string
=
None
):
old_directives
=
dict
(
getattr
(
namespace
,
self
.
dest
,
Options
.
get_directive_defaults
()))
directives
=
Options
.
parse_directive_list
(
values
,
relaxed_bool
=
True
,
current_settings
=
old_directives
)
setattr
(
namespace
,
self
.
dest
,
directives
)
class
ParseOptionsAction
(
Action
):
def
__call__
(
self
,
parser
,
namespace
,
values
,
option_string
=
None
):
options
=
dict
(
getattr
(
namespace
,
self
.
dest
,
{}))
for
opt
in
values
.
split
(
','
):
if
'='
in
opt
:
n
,
v
=
opt
.
split
(
'='
,
1
)
v
=
v
.
lower
()
not
in
(
'false'
,
'f'
,
'0'
,
'no'
)
else
:
n
,
v
=
opt
,
True
options
[
n
]
=
v
setattr
(
namespace
,
self
.
dest
,
options
)
class
ParseCompileTimeEnvAction
(
Action
):
def
__call__
(
self
,
parser
,
namespace
,
values
,
option_string
=
None
):
old_env
=
dict
(
getattr
(
namespace
,
self
.
dest
,
{}))
new_env
=
Options
.
parse_compile_time_env
(
values
,
current_settings
=
old_env
)
setattr
(
namespace
,
self
.
dest
,
new_env
)
parser
=
ArgumentParser
()
parser
=
ArgumentParser
()
...
...
Cython/Compiler/CmdLine.py
View file @
f019888c
This diff is collapsed.
Click to expand it.
Cython/Compiler/Tests/TestCmdLine.py
View file @
f019888c
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment