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
541b01af
Commit
541b01af
authored
Feb 16, 2011
by
Lisandro Dalcin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enable embedded testcase in Python 3
parent
b3dbeb31
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
10 deletions
+24
-10
Demos/embed/Makefile
Demos/embed/Makefile
+2
-1
Demos/embed/assert_equal.py
Demos/embed/assert_equal.py
+11
-5
runtests.py
runtests.py
+11
-4
No files found.
Demos/embed/Makefile
View file @
541b01af
...
...
@@ -19,8 +19,9 @@ embedded: embedded.o
embedded.o
:
embedded.c
$(CC)
-c
$^
-I
$(INCDIR)
CYTHON
=
../../cython.py
embedded.c
:
embedded.pyx
@
$(PYTHON)
../../cython.py
--embed
embedded.pyx
@
$(PYTHON)
$(CYTHON)
--embed
embedded.pyx
all
:
embedded
...
...
Demos/embed/assert_equal.py
View file @
541b01af
import
sys
if
open
(
sys
.
argv
[
1
]).
read
()
!=
open
(
sys
.
argv
[
2
]).
read
():
print
"Files differ"
sys
.
exit
(
1
)
else
:
print
"Files identical"
f1
=
open
(
sys
.
argv
[
1
])
f2
=
open
(
sys
.
argv
[
2
])
try
:
if
f1
.
read
()
!=
f2
.
read
():
print
(
"Files differ"
)
sys
.
exit
(
1
)
else
:
print
(
"Files identical"
)
finally
:
f1
.
close
()
f2
.
close
()
runtests.py
View file @
541b01af
...
...
@@ -28,6 +28,7 @@ except ImportError: # No threads, no problems
threading
=
None
WITH_CYTHON
=
True
CY3_DIR
=
None
from
distutils.dist
import
Distribution
from
distutils.core
import
Extension
...
...
@@ -176,8 +177,8 @@ class TestBuilder(object):
continue
suite
.
addTest
(
self
.
handle_directory
(
path
,
filename
))
if
sys
.
platform
not
in
[
'win32'
]
and
sys
.
version_info
[
0
]
<
3
:
# Non-Windows makefile
, can't run Cython under Py3
.
if
sys
.
platform
not
in
[
'win32'
]:
# Non-Windows makefile.
if
[
1
for
selector
in
self
.
selectors
if
selector
(
"embedded"
)]
\
and
not
[
1
for
selector
in
self
.
exclude_selectors
if
selector
(
"embedded"
)]:
suite
.
addTest
(
unittest
.
makeSuite
(
EmbedTest
))
...
...
@@ -892,8 +893,12 @@ class EmbedTest(unittest.TestCase):
if
not
os
.
path
.
isdir
(
libdir
)
or
libname
not
in
os
.
listdir
(
libdir
):
# report the error for the original directory
libdir
=
sysconfig
.
get_config_var
(
'LIBDIR'
)
cython
=
'cython.py'
if
sys
.
version_info
[
0
]
>=
3
:
cython
=
os
.
path
.
join
(
CY3_DIR
,
cython
)
cython
=
os
.
path
.
abspath
(
os
.
path
.
join
(
'..'
,
'..'
,
cython
))
self
.
assert_
(
os
.
system
(
"make PYTHON='%s'
LIBDIR1='%s' test > make.output"
%
(
sys
.
executable
,
libdir
))
==
0
)
"make PYTHON='%s'
CYTHON='%s' LIBDIR1='%s' test > make.output"
%
(
sys
.
executable
,
cython
,
libdir
))
==
0
)
try
:
os
.
remove
(
'make.output'
)
except
OSError
:
...
...
@@ -967,6 +972,7 @@ def refactor_for_py3(distdir, cy3_dir):
recursive-include Cython *.py *.pyx *.pxd
recursive-include Cython/Debugger/Tests *
include runtests.py
include cython.py
'''
)
sys
.
path
.
insert
(
0
,
cy3_dir
)
...
...
@@ -1105,7 +1111,8 @@ def main():
for
name
in
cy_modules
:
del
sys
.
modules
[
name
]
# hasn't been refactored yet - do it now
cy3_dir
=
os
.
path
.
join
(
WORKDIR
,
'Cy3'
)
global
CY3_DIR
CY3_DIR
=
cy3_dir
=
os
.
path
.
join
(
WORKDIR
,
'Cy3'
)
if
sys
.
version_info
>=
(
3
,
1
):
refactor_for_py3
(
DISTDIR
,
cy3_dir
)
elif
os
.
path
.
isdir
(
cy3_dir
):
...
...
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