Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
nexedi
cython
Commits
24180c84
Commit
24180c84
authored
Nov 29, 2019
by
Matti Picus
Committed by
Stefan Behnel
Nov 29, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TEST: add cpp attribute example from docs, add CYTHON_PROJECT_DIR for tests (GH-2970)
parent
af997e97
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
runtests.py
runtests.py
+4
-0
cpp_class_attrib.srctree
tests/run/cpp_class_attrib.srctree
+26
-0
No files found.
runtests.py
View file @
24180c84
...
@@ -2012,6 +2012,10 @@ def flush_and_terminate(status):
...
@@ -2012,6 +2012,10 @@ def flush_and_terminate(status):
def
main
():
def
main
():
global
DISTDIR
,
WITH_CYTHON
global
DISTDIR
,
WITH_CYTHON
# Set an environment variable to the top directory
os
.
environ
[
'CYTHON_PROJECT_DIR'
]
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
))
DISTDIR
=
os
.
path
.
join
(
os
.
getcwd
(),
os
.
path
.
dirname
(
sys
.
argv
[
0
]))
DISTDIR
=
os
.
path
.
join
(
os
.
getcwd
(),
os
.
path
.
dirname
(
sys
.
argv
[
0
]))
from
Cython.Compiler
import
DebugFlags
from
Cython.Compiler
import
DebugFlags
...
...
tests/run/cpp_class_attrib.srctree
0 → 100644
View file @
24180c84
# tag: cpp
PYTHON setup.py build_ext --inplace
PYTHON -c "import runner"
######## setup.py ########
from Cython.Build.Dependencies import cythonize
from distutils.core import setup
import os
example_dir = os.path.abspath(os.path.join(os.environ['CYTHON_PROJECT_DIR'],
'docs/examples/userguide/wrapping_CPlusPlus'))
ext_modules= cythonize(os.path.join(example_dir, "rect_with_attributes.pyx"),
include_path=[example_dir])
setup(ext_modules=ext_modules)
######## runner.py ########
import rect_with_attributes
x0, y0, x1, y1 = 1, 2, 3, 4
rect_obj = rect_with_attributes.PyRectangle(x0, y0, x1, y1)
assert rect_obj.x0 == x0
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