Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abc
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
abc
Commits
521ec0fc
Commit
521ec0fc
authored
Oct 24, 2011
by
Baruch Sterin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pyabc: fix command line parser in reachx_cmx.py and abcpy_test.py
parent
16e12f18
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
16 deletions
+3
-16
scripts/reachx_cmd.py
+2
-15
src/python/abcpy_test.py
+1
-1
No files found.
scripts/reachx_cmd.py
View file @
521ec0fc
...
...
@@ -43,18 +43,6 @@ def popen_and_wait_with_timeout(timeout,cmd, *args, **kwargs):
return
-
1
@contextmanager
def
replace_sys_argv
(
argv
):
if
'argv'
in
sys
.
__dict__
:
old_argv
=
sys
.
argv
sys
.
argv
=
argv
yield
sys
.
argv
=
old_argv
else
:
sys
.
argv
=
argv
yield
del
sys
.
argv
@contextmanager
def
temp_file_name
(
suffix
=
""
):
file
=
tempfile
.
NamedTemporaryFile
(
delete
=
False
,
suffix
=
suffix
)
name
=
file
.
name
...
...
@@ -105,13 +93,12 @@ def run_reachx_cmd(effort, timeout):
def
reachx_cmd
(
argv
):
usage
=
"usage:
%
prog [options]"
parser
=
optparse
.
OptionParser
(
usage
)
parser
=
optparse
.
OptionParser
(
usage
,
prog
=
"reachx"
)
parser
.
add_option
(
"-e"
,
"--effort"
,
dest
=
"effort"
,
type
=
int
,
default
=
0
,
help
=
"effort level. [default=0, means unlimited]"
)
parser
.
add_option
(
"-t"
,
"--timeout"
,
dest
=
"timeout"
,
type
=
int
,
default
=
0
,
help
=
"timeout in seconds [default=0, unlimited]"
)
with
replace_sys_argv
(
argv
):
options
,
args
=
parser
.
parse_args
()
options
,
args
=
parser
.
parse_args
(
argv
)
rc
=
run_reachx_cmd
(
options
.
effort
,
options
.
timeout
)
print
"
%
s command: jabc returned:
%
d"
%
(
argv
[
0
],
rc
)
...
...
src/python/abcpy_test.py
View file @
521ec0fc
...
...
@@ -34,7 +34,7 @@ import optparse
def
pytest3_cmd
(
args
):
usage
=
"usage:
%
prog [options]"
parser
=
optparse
.
OptionParser
(
usage
)
parser
=
optparse
.
OptionParser
(
usage
,
prog
=
"pytest3"
)
parser
.
add_option
(
"-c"
,
"--cmd"
,
dest
=
"cmd"
,
help
=
"command to ask help for"
)
parser
.
add_option
(
"-v"
,
"--version"
,
action
=
"store_true"
,
dest
=
"version"
,
help
=
"display Python Version"
)
...
...
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