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
Boxiang Sun
cython
Commits
6b3cc5a8
Commit
6b3cc5a8
authored
Jan 22, 2012
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename many of the pyrex_ options to cython_ (as several are Cython-specific).
parent
df41d977
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
109 additions
and
85 deletions
+109
-85
Cython/CodeWriter.py
Cython/CodeWriter.py
+1
-1
Cython/Compiler/MemoryView.py
Cython/Compiler/MemoryView.py
+1
-1
Cython/Debugger/Tests/TestLibCython.py
Cython/Debugger/Tests/TestLibCython.py
+1
-1
Cython/Debugger/Tests/test_libpython_in_gdb.py
Cython/Debugger/Tests/test_libpython_in_gdb.py
+1
-1
Cython/Distutils/build_ext.py
Cython/Distutils/build_ext.py
+79
-55
Cython/Distutils/extension.py
Cython/Distutils/extension.py
+26
-26
No files found.
Cython/CodeWriter.py
View file @
6b3cc5a8
Cython/Compiler/MemoryView.py
View file @
6b3cc5a8
Cython/Debugger/Tests/TestLibCython.py
View file @
6b3cc5a8
...
...
@@ -150,7 +150,7 @@ class DebuggerTestCase(unittest.TestCase):
# ext = Cython.Distutils.extension.Extension(
# 'codefile',
# ['codefile.pyx'],
#
pyrex
_gdb=True,
#
cython
_gdb=True,
# extra_objects=['cfuncs.o'])
#
# distutils.core.setup(
...
...
Cython/Debugger/Tests/test_libpython_in_gdb.py
View file @
6b3cc5a8
Cython/Distutils/build_ext.py
View file @
6b3cc5a8
...
...
@@ -67,6 +67,26 @@ class build_ext(_build_ext.build_ext):
# Add the pyrex specific data.
user_options
.
extend
([
(
'cython-cplus'
,
None
,
"generate C++ source files"
),
(
'cython-create-listing'
,
None
,
"write errors to a listing file"
),
(
'cython-line-directives'
,
None
,
"emit source line directives"
),
(
'cython-include-dirs='
,
None
,
"path to the Cython include files"
+
sep_by
),
(
'cython-c-in-temp'
,
None
,
"put generated C files in temp directory"
),
(
'cython-gen-pxi'
,
None
,
"generate .pxi file for public declarations"
),
(
'cython-directives='
,
None
,
"compiler directive overrides"
),
(
'cython-gdb'
,
None
,
"generate debug information for cygdb"
),
(
'cython-compile-time-env'
,
None
,
"cython compile time environment"
),
# For backwards compatibility.
(
'pyrex-cplus'
,
None
,
"generate C++ source files"
),
(
'pyrex-create-listing'
,
None
,
...
...
@@ -84,36 +104,40 @@ class build_ext(_build_ext.build_ext):
(
'pyrex-gdb'
,
None
,
"generate debug information for cygdb"
),
(
'pyrex-compile-time-env'
,
None
,
"
pyrex
compile time environment"
),
"
cython
compile time environment"
),
])
boolean_options
.
extend
([
'cython-cplus'
,
'cython-create-listing'
,
'cython-line-directives'
,
'cython-c-in-temp'
,
'cython-gdb'
,
# For backwards compatibility.
'pyrex-cplus'
,
'pyrex-create-listing'
,
'pyrex-line-directives'
,
'pyrex-c-in-temp'
,
'pyrex-gdb'
,
])
def
initialize_options
(
self
):
_build_ext
.
build_ext
.
initialize_options
(
self
)
self
.
pyrex
_cplus
=
0
self
.
pyrex
_create_listing
=
0
self
.
pyrex
_line_directives
=
0
self
.
pyrex
_include_dirs
=
None
self
.
pyrex
_directives
=
None
self
.
pyrex
_c_in_temp
=
0
self
.
pyrex
_gen_pxi
=
0
self
.
pyrex
_gdb
=
False
self
.
cython
_cplus
=
0
self
.
cython
_create_listing
=
0
self
.
cython
_line_directives
=
0
self
.
cython
_include_dirs
=
None
self
.
cython
_directives
=
None
self
.
cython
_c_in_temp
=
0
self
.
cython
_gen_pxi
=
0
self
.
cython
_gdb
=
False
self
.
no_c_in_traceback
=
0
self
.
pyrex
_compile_time_env
=
None
self
.
cython
_compile_time_env
=
None
def
finalize_options
(
self
):
_build_ext
.
build_ext
.
finalize_options
(
self
)
if
self
.
pyrex
_include_dirs
is
None
:
self
.
pyrex
_include_dirs
=
[]
elif
isinstance
(
self
.
pyrex
_include_dirs
,
basestring
):
self
.
pyrex
_include_dirs
=
\
self
.
pyrex
_include_dirs
.
split
(
os
.
pathsep
)
if
self
.
pyrex
_directives
is
None
:
self
.
pyrex
_directives
=
{}
if
self
.
cython
_include_dirs
is
None
:
self
.
cython
_include_dirs
=
[]
elif
isinstance
(
self
.
cython
_include_dirs
,
basestring
):
self
.
cython
_include_dirs
=
\
self
.
cython
_include_dirs
.
split
(
os
.
pathsep
)
if
self
.
cython
_directives
is
None
:
self
.
cython
_directives
=
{}
# finalize_options ()
def
run
(
self
):
...
...
@@ -121,8 +145,8 @@ class build_ext(_build_ext.build_ext):
# If --pyrex-gdb is in effect as a command line option or as option
# of any Extension module, disable optimization for the C or C++
# compiler.
if
self
.
pyrex
_gdb
or
[
1
for
ext
in
self
.
extensions
if
getattr
(
ext
,
'
pyrex
_gdb'
,
False
)]:
if
self
.
cython
_gdb
or
[
1
for
ext
in
self
.
extensions
if
getattr
(
ext
,
'
cython
_gdb'
,
False
)]:
optimization
.
disable_optimization
()
_build_ext
.
build_ext
.
run
(
self
)
...
...
@@ -145,7 +169,7 @@ class build_ext(_build_ext.build_ext):
try
:
from
Cython.Compiler.Main
\
import
CompilationOptions
,
\
default_options
as
pyrex
_default_options
,
\
default_options
as
cython
_default_options
,
\
compile
as
cython_compile
from
Cython.Compiler.Errors
import
PyrexError
except
ImportError
:
...
...
@@ -154,8 +178,8 @@ class build_ext(_build_ext.build_ext):
raise
DistutilsPlatformError
(
"Cython does not appear to be installed"
)
new_sources
=
[]
pyrex
_sources
=
[]
pyrex
_targets
=
{}
cython
_sources
=
[]
cython
_targets
=
{}
# Setup create_list and cplus from the extension options if
# Cython.Distutils.extension.Extension is used, otherwise just
...
...
@@ -163,39 +187,39 @@ class build_ext(_build_ext.build_ext):
# cplus will also be set to true is extension.language is equal to
# 'C++' or 'c++'.
#try:
# create_listing = self.
pyrex
_create_listing or \
# extension.
pyrex
_create_listing
# cplus = self.
pyrex
_cplus or \
# extension.
pyrex
_cplus or \
# create_listing = self.
cython
_create_listing or \
# extension.
cython
_create_listing
# cplus = self.
cython
_cplus or \
# extension.
cython
_cplus or \
# (extension.language != None and \
# extension.language.lower() == 'c++')
#except AttributeError:
# create_listing = self.
pyrex
_create_listing
# cplus = self.
pyrex
_cplus or \
# create_listing = self.
cython
_create_listing
# cplus = self.
cython
_cplus or \
# (extension.language != None and \
# extension.language.lower() == 'c++')
create_listing
=
self
.
pyrex
_create_listing
or
\
getattr
(
extension
,
'
pyrex
_create_listing'
,
0
)
line_directives
=
self
.
pyrex
_line_directives
or
\
getattr
(
extension
,
'
pyrex
_line_directives'
,
0
)
create_listing
=
self
.
cython
_create_listing
or
\
getattr
(
extension
,
'
cython
_create_listing'
,
0
)
line_directives
=
self
.
cython
_line_directives
or
\
getattr
(
extension
,
'
cython
_line_directives'
,
0
)
no_c_in_traceback
=
self
.
no_c_in_traceback
or
\
getattr
(
extension
,
'no_c_in_traceback'
,
0
)
cplus
=
self
.
pyrex_cplus
or
getattr
(
extension
,
'pyrex
_cplus'
,
0
)
or
\
cplus
=
self
.
cython_cplus
or
getattr
(
extension
,
'cython
_cplus'
,
0
)
or
\
(
extension
.
language
and
extension
.
language
.
lower
()
==
'c++'
)
pyrex_gen_pxi
=
self
.
pyrex_gen_pxi
or
getattr
(
extension
,
'pyrex
_gen_pxi'
,
0
)
pyrex_gdb
=
self
.
pyrex_gdb
or
getattr
(
extension
,
'pyrex
_gdb'
,
False
)
pyrex_compile_time_env
=
self
.
pyrex
_compile_time_env
or
\
getattr
(
extension
,
'
pyrex
_compile_time_env'
,
None
)
cython_gen_pxi
=
self
.
cython_gen_pxi
or
getattr
(
extension
,
'cython
_gen_pxi'
,
0
)
cython_gdb
=
self
.
cython_gdb
or
getattr
(
extension
,
'cython
_gdb'
,
False
)
cython_compile_time_env
=
self
.
cython
_compile_time_env
or
\
getattr
(
extension
,
'
cython
_compile_time_env'
,
None
)
# Set up the include_path for the Cython compiler:
# 1. Start with the command line option.
# 2. Add in any (unique) paths from the extension
#
pyrex
_include_dirs (if Cython.Distutils.extension is used).
#
cython
_include_dirs (if Cython.Distutils.extension is used).
# 3. Add in any (unique) paths from the extension include_dirs
includes
=
self
.
pyrex
_include_dirs
includes
=
self
.
cython
_include_dirs
try
:
for
i
in
extension
.
pyrex
_include_dirs
:
for
i
in
extension
.
cython
_include_dirs
:
if
not
i
in
includes
:
includes
.
append
(
i
)
except
AttributeError
:
...
...
@@ -207,10 +231,10 @@ class build_ext(_build_ext.build_ext):
# Set up Cython compiler directives:
# 1. Start with the command line option.
# 2. Add in any (unique) entries from the extension
#
pyrex
_directives (if Cython.Distutils.extension is used).
directives
=
self
.
pyrex
_directives
if
hasattr
(
extension
,
"
pyrex
_directives"
):
directives
.
update
(
extension
.
pyrex
_directives
)
#
cython
_directives (if Cython.Distutils.extension is used).
directives
=
self
.
cython
_directives
if
hasattr
(
extension
,
"
cython
_directives"
):
directives
.
update
(
extension
.
cython
_directives
)
# Set the target_ext to '.c'. Cython will change this to '.cpp' if
# needed.
...
...
@@ -222,8 +246,8 @@ class build_ext(_build_ext.build_ext):
# Decide whether to drop the generated C files into the temp dir
# or the source tree.
if
not
self
.
inplace
and
(
self
.
pyrex
_c_in_temp
or
getattr
(
extension
,
'
pyrex
_c_in_temp'
,
0
)):
if
not
self
.
inplace
and
(
self
.
cython
_c_in_temp
or
getattr
(
extension
,
'
cython
_c_in_temp'
,
0
)):
target_dir
=
os
.
path
.
join
(
self
.
build_temp
,
"pyrex"
)
for
package_name
in
extension
.
name
.
split
(
'.'
)[:
-
1
]:
target_dir
=
os
.
path
.
join
(
target_dir
,
package_name
)
...
...
@@ -239,8 +263,8 @@ class build_ext(_build_ext.build_ext):
if
ext
==
".pyx"
:
# Cython source file
output_dir
=
target_dir
or
os
.
path
.
dirname
(
source
)
new_sources
.
append
(
os
.
path
.
join
(
output_dir
,
base
+
target_ext
))
pyrex
_sources
.
append
(
source
)
pyrex
_targets
[
source
]
=
new_sources
[
-
1
]
cython
_sources
.
append
(
source
)
cython
_targets
[
source
]
=
new_sources
[
-
1
]
elif
ext
==
'.pxi'
or
ext
==
'.pxd'
:
if
newest_dependency
is
None
\
or
newer
(
source
,
newest_dependency
):
...
...
@@ -248,13 +272,13 @@ class build_ext(_build_ext.build_ext):
else
:
new_sources
.
append
(
source
)
if
not
pyrex
_sources
:
if
not
cython
_sources
:
return
new_sources
module_name
=
extension
.
name
for
source
in
pyrex
_sources
:
target
=
pyrex
_targets
[
source
]
for
source
in
cython
_sources
:
target
=
cython
_targets
[
source
]
depends
=
[
source
]
+
list
(
extension
.
depends
or
())
rebuild
=
self
.
force
or
newer_group
(
depends
,
target
,
'newer'
)
if
not
rebuild
and
newest_dependency
is
not
None
:
...
...
@@ -266,7 +290,7 @@ class build_ext(_build_ext.build_ext):
output_dir
=
os
.
curdir
else
:
output_dir
=
self
.
build_lib
options
=
CompilationOptions
(
pyrex
_default_options
,
options
=
CompilationOptions
(
cython
_default_options
,
use_listing_file
=
create_listing
,
include_path
=
includes
,
compiler_directives
=
directives
,
...
...
@@ -274,10 +298,10 @@ class build_ext(_build_ext.build_ext):
cplus
=
cplus
,
emit_linenums
=
line_directives
,
c_line_in_traceback
=
not
no_c_in_traceback
,
generate_pxi
=
pyrex
_gen_pxi
,
generate_pxi
=
cython
_gen_pxi
,
output_dir
=
output_dir
,
gdb_debug
=
pyrex
_gdb
,
compile_time_env
=
pyrex
_compile_time_env
)
gdb_debug
=
cython
_gdb
,
compile_time_env
=
cython
_compile_time_env
)
result
=
cython_compile
(
source
,
options
=
options
,
full_module_name
=
module_name
)
else
:
...
...
Cython/Distutils/extension.py
View file @
6b3cc5a8
...
...
@@ -17,22 +17,22 @@ except ImportError:
class
Extension
(
_Extension
.
Extension
):
_Extension
.
Extension
.
__doc__
+
\
"""
pyrex
_include_dirs : [string]
"""
cython
_include_dirs : [string]
list of directories to search for Pyrex header files (.pxd) (in
Unix form for portability)
pyrex
_directives : {string:value}
cython
_directives : {string:value}
dict of compiler directives
pyrex
_create_listing_file : boolean
cython
_create_listing_file : boolean
write pyrex error messages to a listing (.lis) file.
pyrex
_line_directives : boolean
cython
_line_directives : boolean
emit pyx line numbers for debugging/profiling
pyrex
_cplus : boolean
cython
_cplus : boolean
use the C++ compiler for compiling and linking.
pyrex
_c_in_temp : boolean
cython
_c_in_temp : boolean
put generated C files in temp directory.
pyrex
_gen_pxi : boolean
cython
_gen_pxi : boolean
generate .pxi file for public declarations
pyrex
_gdb : boolean
cython
_gdb : boolean
generate Cython debug information for this extension for cygdb
no_c_in_traceback : boolean
emit the c file and line number from the traceback for exceptions
...
...
@@ -54,16 +54,16 @@ class Extension(_Extension.Extension):
#swig_opts = None,
depends
=
None
,
language
=
None
,
pyrex
_include_dirs
=
None
,
pyrex
_directives
=
None
,
pyrex
_create_listing
=
0
,
pyrex
_line_directives
=
0
,
pyrex
_cplus
=
0
,
pyrex
_c_in_temp
=
0
,
pyrex
_gen_pxi
=
0
,
pyrex
_gdb
=
False
,
cython
_include_dirs
=
None
,
cython
_directives
=
None
,
cython
_create_listing
=
0
,
cython
_line_directives
=
0
,
cython
_cplus
=
0
,
cython
_c_in_temp
=
0
,
cython
_gen_pxi
=
0
,
cython
_gdb
=
False
,
no_c_in_traceback
=
False
,
pyrex
_compile_time_env
=
None
,
cython
_compile_time_env
=
None
,
**
kw
):
_Extension
.
Extension
.
__init__
(
self
,
name
,
sources
,
...
...
@@ -82,16 +82,16 @@ class Extension(_Extension.Extension):
language
=
language
,
**
kw
)
self
.
pyrex_include_dirs
=
pyrex
_include_dirs
or
[]
self
.
pyrex_directives
=
pyrex
_directives
or
{}
self
.
pyrex_create_listing
=
pyrex
_create_listing
self
.
pyrex_line_directives
=
pyrex
_line_directives
self
.
pyrex_cplus
=
pyrex
_cplus
self
.
pyrex_c_in_temp
=
pyrex
_c_in_temp
self
.
pyrex_gen_pxi
=
pyrex
_gen_pxi
self
.
pyrex_gdb
=
pyrex
_gdb
self
.
cython_include_dirs
=
cython
_include_dirs
or
[]
self
.
cython_directives
=
cython
_directives
or
{}
self
.
cython_create_listing
=
cython
_create_listing
self
.
cython_line_directives
=
cython
_line_directives
self
.
cython_cplus
=
cython
_cplus
self
.
cython_c_in_temp
=
cython
_c_in_temp
self
.
cython_gen_pxi
=
cython
_gen_pxi
self
.
cython_gdb
=
cython
_gdb
self
.
no_c_in_traceback
=
no_c_in_traceback
self
.
pyrex_compile_time_env
=
pyrex
_compile_time_env
self
.
cython_compile_time_env
=
cython
_compile_time_env
# class Extension
...
...
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