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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
80ebf7c1
Commit
80ebf7c1
authored
Oct 19, 2014
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean up gdb version test in TestLibCython.py
parent
dec3890d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
29 deletions
+18
-29
Cython/Debugger/Tests/TestLibCython.py
Cython/Debugger/Tests/TestLibCython.py
+18
-29
No files found.
Cython/Debugger/Tests/TestLibCython.py
View file @
80ebf7c1
...
...
@@ -35,50 +35,39 @@ def test_gdb():
if
have_gdb
is
not
None
:
return
have_gdb
have_gdb
=
False
try
:
p
=
subprocess
.
Popen
([
'gdb'
,
'-v'
],
stdout
=
subprocess
.
PIPE
)
have_gdb
=
True
p
=
subprocess
.
Popen
([
'gdb'
,
'-nx'
,
'--version'
],
stdout
=
subprocess
.
PIPE
)
except
OSError
:
# gdb
was not installe
d
have_gdb
=
Fals
e
# gdb
not foun
d
gdb_version
=
Non
e
else
:
gdb_version
=
p
.
stdout
.
read
().
decode
(
'ascii'
,
'ignore'
)
p
.
wait
()
p
.
stdout
.
close
()
if
have_gdb
:
stdout
,
_
=
p
.
communicate
()
# Based on Lib/test/test_gdb.py
regex
=
"
^
GNU gdb [^
\
d]*(
\
d+)
\
.(
\
d+)"
gdb_version
_number
=
list
(
map
(
int
,
re
.
search
(
regex
,
gdb_version
).
groups
()
))
regex
=
"GNU gdb [^
\
d]*(
\
d+)
\
.(
\
d+)"
gdb_version
=
re
.
match
(
regex
,
stdout
.
decode
(
'ascii'
,
'ignore'
))
if
gdb_version
:
gdb_version_number
=
list
(
map
(
int
,
gdb_version
.
groups
()))
if
gdb_version_number
>=
[
7
,
2
]:
python_version_script
=
tempfile
.
NamedTemporaryFile
(
mode
=
'w+'
)
try
:
have_gdb
=
True
with
tempfile
.
NamedTemporaryFile
(
mode
=
'w+'
)
as
python_version_script
:
python_version_script
.
write
(
'python import sys; print("%s %s" % sys.version_info[:2])'
)
python_version_script
.
flush
()
p
=
subprocess
.
Popen
([
'gdb'
,
'-batch'
,
'-x'
,
python_version_script
.
name
],
stdout
=
subprocess
.
PIPE
)
stdout
,
_
=
p
.
communicate
()
try
:
python_version
=
p
.
stdout
.
read
().
decode
(
'ascii'
)
p
.
wait
()
finally
:
p
.
stdout
.
close
()
try
:
python_version_number
=
list
(
map
(
int
,
python_version
.
split
()))
except
ValueError
:
internal_python_version
=
list
(
map
(
int
,
stdout
.
decode
(
'ascii'
,
'ignore'
).
split
()))
if
internal_python_version
<
[
2
,
6
]:
have_gdb
=
False
finally
:
python_version_script
.
close
()
# Be Python 3 compatible
if
(
not
have_gdb
or
gdb_version_number
<
[
7
,
2
]
or
python_version_number
<
[
2
,
6
]):
warnings
.
warn
(
'Skipping gdb tests, need gdb >= 7.2 with Python >= 2.6'
)
except
ValueError
:
have_gdb
=
False
if
not
have_gdb
:
warnings
.
warn
(
'Skipping gdb tests, need gdb >= 7.2 with Python >= 2.6'
)
return
have_gdb
...
...
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