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
Gwenaël Samain
cython
Commits
0f6e78a7
Commit
0f6e78a7
authored
Oct 03, 2014
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
undo last commit
parent
f65206a8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
26 deletions
+8
-26
CHANGES.rst
CHANGES.rst
+0
-4
Cython/Build/Dependencies.py
Cython/Build/Dependencies.py
+2
-14
docs/src/userguide/wrapping_CPlusPlus.rst
docs/src/userguide/wrapping_CPlusPlus.rst
+3
-7
tests/build/cpp_cythonize.srctree
tests/build/cpp_cythonize.srctree
+3
-1
No files found.
CHANGES.rst
View file @
0f6e78a7
...
...
@@ -8,10 +8,6 @@ Latest
Features added
--------------
* Passing ``language='c++'`` into cythonize() globally enables C++ mode for
all modules that were not passed as Extension objects (i.e. only source
files and file patterns).
* ``Py_hash_t`` is a known type (used in CPython for hash values).
* ``PySlice_*()`` C-API functions are available from the ``cpython.slice``
...
...
Cython/Build/Dependencies.py
View file @
0f6e78a7
...
...
@@ -586,8 +586,7 @@ def create_dependency_tree(ctx=None, quiet=False):
# This may be useful for advanced users?
def
create_extension_list
(
patterns
,
exclude
=
[],
ctx
=
None
,
aliases
=
None
,
quiet
=
False
,
language
=
None
,
exclude_failures
=
False
):
def
create_extension_list
(
patterns
,
exclude
=
[],
ctx
=
None
,
aliases
=
None
,
quiet
=
False
,
exclude_failures
=
False
):
if
not
isinstance
(
patterns
,
(
list
,
tuple
)):
patterns
=
[
patterns
]
explicit_modules
=
set
([
m
.
name
for
m
in
patterns
if
isinstance
(
m
,
Extension
)])
...
...
@@ -607,7 +606,6 @@ def create_extension_list(patterns, exclude=[], ctx=None, aliases=None, quiet=Fa
name
=
'*'
base
=
None
exn_type
=
Extension
ext_language
=
language
elif
isinstance
(
pattern
,
Extension
):
for
filepattern
in
pattern
.
sources
:
if
os
.
path
.
splitext
(
filepattern
)[
1
]
in
(
'.py'
,
'.pyx'
):
...
...
@@ -620,7 +618,6 @@ def create_extension_list(patterns, exclude=[], ctx=None, aliases=None, quiet=Fa
name
=
template
.
name
base
=
DistutilsInfo
(
exn
=
template
)
exn_type
=
template
.
__class__
ext_language
=
None
# do not override whatever the Extension says
else
:
raise
TypeError
(
pattern
)
...
...
@@ -664,9 +661,6 @@ def create_extension_list(patterns, exclude=[], ctx=None, aliases=None, quiet=Fa
depends
=
list
(
set
(
template
.
depends
).
union
(
set
(
depends
)))
kwds
[
'depends'
]
=
depends
if
ext_language
and
'language'
not
in
kwds
:
kwds
[
'language'
]
=
ext_language
module_list
.
append
(
exn_type
(
name
=
module_name
,
sources
=
sources
,
...
...
@@ -677,7 +671,7 @@ def create_extension_list(patterns, exclude=[], ctx=None, aliases=None, quiet=Fa
# This is the user-exposed entry point.
def
cythonize
(
module_list
,
exclude
=
[],
nthreads
=
0
,
aliases
=
None
,
quiet
=
False
,
force
=
False
,
language
=
None
,
def
cythonize
(
module_list
,
exclude
=
[],
nthreads
=
0
,
aliases
=
None
,
quiet
=
False
,
force
=
False
,
exclude_failures
=
False
,
**
options
):
"""
Compile a set of source modules into C/C++ files and return a list of distutils
...
...
@@ -690,11 +684,6 @@ def cythonize(module_list, exclude=[], nthreads=0, aliases=None, quiet=False, fo
When using glob patterns, you can exclude certain module names explicitly
by passing them into the 'exclude' option.
To globally enable C++ mode, you can pass language='c++'. Otherwise, this
will be determined at a per-file level based on compiler directives. This
affects only modules found based on file names. Extension instances passed
into cythonize() will not be changed.
For parallel compilation, set the 'nthreads' option to the number of
concurrent builds.
...
...
@@ -722,7 +711,6 @@ def cythonize(module_list, exclude=[], nthreads=0, aliases=None, quiet=False, fo
ctx
=
ctx
,
quiet
=
quiet
,
exclude_failures
=
exclude_failures
,
language
=
language
,
aliases
=
aliases
)
deps
=
create_dependency_tree
(
ctx
,
quiet
=
quiet
)
build_dir
=
getattr
(
options
,
'build_dir'
,
None
)
...
...
docs/src/userguide/wrapping_CPlusPlus.rst
View file @
0f6e78a7
...
...
@@ -137,14 +137,10 @@ together into :file:`rect.so`, which you can then import in Python using
``import rect`` (if you forget to link the :file:`Rectangle.o`, you will
get missing symbols while importing the library in Python).
Note that the ``language`` option has no effect on user provided Extension
objects that are passed into ``cythonize()``. It is only used for modules
found by file name (as in the example above).
The options can also be passed directly from the source file, which is
often preferable
(and overrides any global option). Starting with
version 0.17, Cython also allows to pass external source files into the
``cythonize()`` command this way.
Here is a simplified setup.py file::
often preferable
. Starting with version 0.17, Cython also allows to
pass external source files into the ``cythonize()`` command this way.
Here is a simplified setup.py file::
from distutils.core import setup
from Cython.Build import cythonize
...
...
tests/build/cpp_cythonize.srctree
View file @
0f6e78a7
...
...
@@ -10,11 +10,13 @@ from Cython.Build.Dependencies import cythonize
from distutils.core import setup
setup(
ext_modules = cythonize("*.pyx", language='c++'
),
ext_modules = cythonize("*.pyx"
),
)
######## a.pyx ########
# distutils: language = c++
from libcpp.vector cimport vector
def use_vector(L):
...
...
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